From 6436f96fd164ebbdf240ff918f6919304e9445ec Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Wed, 14 Oct 2015 08:08:28 -0700 Subject: [PATCH] fix(transformers): show nice error message when an invalid uri is found Closes #4731 --- .../transform/lib/src/transform/common/code/uri.dart | 2 +- .../transform/lib/src/transform/common/url_resolver.dart | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules_dart/transform/lib/src/transform/common/code/uri.dart b/modules_dart/transform/lib/src/transform/common/code/uri.dart index 9f7edbd150..4a2d58f4de 100644 --- a/modules_dart/transform/lib/src/transform/common/code/uri.dart +++ b/modules_dart/transform/lib/src/transform/common/code/uri.dart @@ -61,7 +61,7 @@ bool _canImportRelative(Uri importUri, {Uri from}) { bool _canPackageImport(Uri assetImport) { if (assetImport == null) throw new ArgumentError.notNull('assetImport'); if (!assetImport.isAbsolute || assetImport.scheme != 'asset') { - throw new ArgumentError.value(assetImport, 'assetImport', + throw new ArgumentError.value(assetImport.toString(), 'assetImport', 'Must be an absolute uri using the asset: scheme'); } return assetImport.pathSegments.length >= 2 && diff --git a/modules_dart/transform/lib/src/transform/common/url_resolver.dart b/modules_dart/transform/lib/src/transform/common/url_resolver.dart index 2f38188852..56290aadfa 100644 --- a/modules_dart/transform/lib/src/transform/common/url_resolver.dart +++ b/modules_dart/transform/lib/src/transform/common/url_resolver.dart @@ -46,7 +46,7 @@ Uri toAssetScheme(Uri absoluteUri) { if (!absoluteUri.isAbsolute) { throw new ArgumentError.value( - absoluteUri, 'absoluteUri', 'Value passed must be an absolute uri'); + absoluteUri.toString(), 'absoluteUri', 'Value passed must be an absolute uri'); } if (absoluteUri.scheme == 'asset') { if (absoluteUri.pathSegments.length < 3) { @@ -54,7 +54,7 @@ Uri toAssetScheme(Uri absoluteUri) { 'An asset: URI must have at least 3 path ' 'segments, for example ' 'asset://.', - absoluteUri); + absoluteUri.toString()); } return absoluteUri; } @@ -68,7 +68,7 @@ Uri toAssetScheme(Uri absoluteUri) { 'A package: URI must have at least 2 path ' 'segments, for example ' 'package:/', - absoluteUri); + absoluteUri.toString()); } var pathSegments = absoluteUri.pathSegments.toList()..insert(1, 'lib');