Skip to content

Commit

Permalink
reverting changes for js
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentBlanckaert committed Nov 22, 2024
1 parent 60146bb commit 23c3e4e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions tested/languages/javascript/templates/values.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,24 @@ function sendException(stream, exception) {
"type": exception.constructor.name
}));
} else {
// We have something else, so we cannot rely on stuff being present.
fs.writeSync(stream, JSON.stringify({
"message": JSON.stringify(exception),
"stacktrace": "",
"type": exception.constructor.name ?? (Object.prototype.toString.call(exception)),
"additional_message_keys": ["languages.javascript.runtime.invalid.exception"]
}));
// Temporarily allow objects with "message" and "name".
// TODO: remove this once the semester is over
// noinspection PointlessBooleanExpressionJS
if (typeof exception === 'object') {
fs.writeSync(stream, JSON.stringify({
"message": exception.message ?? "",
"stacktrace": "",
"type": exception.name ?? ""
}));
} else {
// We have something else, so we cannot rely on stuff being present.
fs.writeSync(stream, JSON.stringify({
"message": JSON.stringify(exception),
"stacktrace": "",
"type": exception.constructor.name ?? (Object.prototype.toString.call(exception)),
"additional_message_keys": ["languages.javascript.runtime.invalid.exception"]
}));
}
}
}

Expand Down

0 comments on commit 23c3e4e

Please sign in to comment.