From ab974e202b49512f92b2f80e451dbe7d41692c92 Mon Sep 17 00:00:00 2001 From: BennettJames Date: Thu, 17 Dec 2015 22:42:29 -0800 Subject: [PATCH] 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. --- src/transpiler.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/transpiler.js b/src/transpiler.js index e499d34..79c3d96 100644 --- a/src/transpiler.js +++ b/src/transpiler.js @@ -47,8 +47,12 @@ var transpile = (function() { return compiler.compile(source, filename); } catch(e) { - // traceur throws an error array - throw e[0]; + // on older versions of traceur (<0.9.3), an array of errors is thrown + // rather than a single error. + if (e.length) { + throw e[0]; + } + throw e; } }