Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/errors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export function RuntimeError(message, input) {
export function RuntimeError(message, input, cause = undefined) {
this.message = message + "";
this.input = input;
this.cause = cause;
}

RuntimeError.prototype = Object.create(Error.prototype);
Expand Down
2 changes: 1 addition & 1 deletion src/variable.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function variable_undefined() {
function variable_rejector(variable) {
return function(error) {
if (error === variable_undefined) throw new RuntimeError(variable._name + " is not defined", variable._name);
if (error instanceof Error && error.message) throw new RuntimeError(error.message, variable._name);
if (error instanceof Error && error.message) throw new RuntimeError(error.message, variable._name, error);
throw new RuntimeError(variable._name + " could not be resolved", variable._name);
};
}
Expand Down