Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit ab974e2

Browse files
author
BennettJames
committed
Previously, Traceur would return an array of errors when several were
detected during compilation. The module loader would just report the first. In 0.9.3 though, Tracuer was updated to instead throw a single "MultipleErrors" type that contained all the errors inside it. The module loader currently just reports "undefined" as the error, as there is no array with elements, making for a rather opaque error when a compilation error occurs. This modifies it to still throw the first element when dealing with an array for backwards compatibility, but will otherwise throw the full exception.
1 parent b71f22f commit ab974e2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/transpiler.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ var transpile = (function() {
4747
return compiler.compile(source, filename);
4848
}
4949
catch(e) {
50-
// traceur throws an error array
51-
throw e[0];
50+
// on older versions of traceur (<0.9.3), an array of errors is thrown
51+
// rather than a single error.
52+
if (e.length) {
53+
throw e[0];
54+
}
55+
throw e;
5256
}
5357
}
5458

0 commit comments

Comments
 (0)