X Tutup
Skip to content

Commit cfef76f

Browse files
Tim Blasikegluneq
authored andcommitted
refactor(dart/transform): Error in name convert funcs on unexpected input
Issue raised in PR angular#6745. Previously, the transformer name conversion functions could return the input string on unexpected input, which is almost certainly an error. `throw` in this case instead, so we know early that something has likely gone wrong. Closes angular#6753
1 parent f56df65 commit cfef76f

File tree

1 file changed

+5
-1
lines changed
  • modules_dart/transform/lib/src/transform/common

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,9 @@ String _toExtension(
8484
'$toExtension';
8585
}
8686
}
87-
return uri;
87+
throw new ArgumentError.value(
88+
uri,
89+
'uri',
90+
'Provided value ends with an unexpected extension. '
91+
'Expected extension(s): [${fromExtensions.join(', ')}].');
8892
}

0 commit comments

Comments
 (0)
X Tutup