Skip to content

Commit

Permalink
fix: revert js_class_and_message_to_exception to just do TypeErrors (#…
Browse files Browse the repository at this point in the history
…1037)

This is the previous behaviour which was unexpected and we want to
change this to actually throw the correct error, however this is
breaking a few things in CLI so reverting this single change for now and
will revisit at a later date
  • Loading branch information
crowlKats authored Jan 8, 2025
1 parent 403d711 commit 7c80d46
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,22 @@ pub fn throw_js_error_class(

fn js_class_and_message_to_exception<'s>(
scope: &mut v8::HandleScope<'s>,
class: &str,
_class: &str,
message: &str,
) -> v8::Local<'s, v8::Value> {
let message = v8::String::new(scope, message).unwrap();
/*
commented out since this was previously only handling type errors, but this
change is breaking CLI, so visiting on a later date
match class {
TYPE_ERROR => v8::Exception::type_error(scope, message),
RANGE_ERROR => v8::Exception::range_error(scope, message),
REFERENCE_ERROR => v8::Exception::reference_error(scope, message),
SYNTAX_ERROR => v8::Exception::syntax_error(scope, message),
_ => v8::Exception::error(scope, message),
}
}*/
v8::Exception::type_error(scope, message)
}

pub fn to_v8_error<'a>(
Expand Down

0 comments on commit 7c80d46

Please sign in to comment.