X Tutup
Skip to content

Commit 6436f96

Browse files
committed
fix(transformers): show nice error message when an invalid uri is found
Closes #4731
1 parent efddc90 commit 6436f96

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules_dart/transform/lib/src/transform/common/code/uri.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ bool _canImportRelative(Uri importUri, {Uri from}) {
6161
bool _canPackageImport(Uri assetImport) {
6262
if (assetImport == null) throw new ArgumentError.notNull('assetImport');
6363
if (!assetImport.isAbsolute || assetImport.scheme != 'asset') {
64-
throw new ArgumentError.value(assetImport, 'assetImport',
64+
throw new ArgumentError.value(assetImport.toString(), 'assetImport',
6565
'Must be an absolute uri using the asset: scheme');
6666
}
6767
return assetImport.pathSegments.length >= 2 &&

modules_dart/transform/lib/src/transform/common/url_resolver.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ Uri toAssetScheme(Uri absoluteUri) {
4646

4747
if (!absoluteUri.isAbsolute) {
4848
throw new ArgumentError.value(
49-
absoluteUri, 'absoluteUri', 'Value passed must be an absolute uri');
49+
absoluteUri.toString(), 'absoluteUri', 'Value passed must be an absolute uri');
5050
}
5151
if (absoluteUri.scheme == 'asset') {
5252
if (absoluteUri.pathSegments.length < 3) {
5353
throw new FormatException(
5454
'An asset: URI must have at least 3 path '
5555
'segments, for example '
5656
'asset:<package-name>/<first-level-dir>/<path-to-dart-file>.',
57-
absoluteUri);
57+
absoluteUri.toString());
5858
}
5959
return absoluteUri;
6060
}
@@ -68,7 +68,7 @@ Uri toAssetScheme(Uri absoluteUri) {
6868
'A package: URI must have at least 2 path '
6969
'segments, for example '
7070
'package:<package-name>/<path-to-dart-file>',
71-
absoluteUri);
71+
absoluteUri.toString());
7272
}
7373

7474
var pathSegments = absoluteUri.pathSegments.toList()..insert(1, 'lib');

0 commit comments

Comments
 (0)
X Tutup