From cfef76f683ddbaed20cfd12fd0a72e85d2dd6854 Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Thu, 28 Jan 2016 12:14:36 -0800 Subject: [PATCH] refactor(dart/transform): Error in name convert funcs on unexpected input Issue raised in PR #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 #6753 --- modules_dart/transform/lib/src/transform/common/names.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules_dart/transform/lib/src/transform/common/names.dart b/modules_dart/transform/lib/src/transform/common/names.dart index db5e8ffe25..44c87e9ab0 100644 --- a/modules_dart/transform/lib/src/transform/common/names.dart +++ b/modules_dart/transform/lib/src/transform/common/names.dart @@ -84,5 +84,9 @@ String _toExtension( '$toExtension'; } } - return uri; + throw new ArgumentError.value( + uri, + 'uri', + 'Provided value ends with an unexpected extension. ' + 'Expected extension(s): [${fromExtensions.join(', ')}].'); }