Skip to content

Commit f7cb211

Browse files
committed
more tsc stuff
1 parent 93ccc9b commit f7cb211

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎v4-cokapi/backends/javascript/jslogger.js‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ TypeScript TODOs:
8080
anyhow? e.g., see demo2.ts Inheritance example from
8181
http://www.typescriptlang.org/Playground)
8282
83+
- display more than one error in the trace when there's a TypeScript
84+
compiler error. right now we display only the first error for simplicity.
85+
8386
*/
8487

8588

@@ -893,9 +896,19 @@ if (argv.typescript) {
893896
// if there are any errors, then handle them here, create a trace, and
894897
// bail out before executing!
895898
if (tscCompilerOutput.errors.length > 0) {
896-
console.log("HAS ERRORS!");
897-
// TODO: handle displaying multiple errors at once
898-
process.exit();
899+
// right now just grab and display the first error
900+
// TODO: handle displaying multiple errors
901+
902+
var firstErr = tscCompilerOutput.errors[0];
903+
904+
var errorTraceEntry = {};
905+
errorTraceEntry.event = 'uncaught_exception';
906+
907+
errorTraceEntry.exception_msg = firstErr.msg;
908+
errorTraceEntry.line = firstErr.line;
909+
curTrace.push(errorTraceEntry);
910+
finalize();
911+
process.exit(); // bail out early!!!
899912
} else {
900913
// strip off the final line, which should say something like:
901914
// '//# sourceMappingURL=file.js.map'

0 commit comments

Comments
 (0)