Skip to content

Commit

Permalink
fix(boa_engine): fix conversion from undefined to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ryutamago authored and johnyob committed Oct 7, 2024
1 parent 5ba29ab commit aac8213
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/engine/src/value/conversions/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ impl JsValue {
pub fn to_json(&self, context: &mut Context) -> JsResult<Value> {
match self {
Self::Null => Ok(Value::Null),
Self::Undefined => todo!("undefined to JSON"),
Self::Undefined => Err(JsNativeError::typ()
.with_message("cannot convert undefined to JSON")
.into()),
&Self::Boolean(b) => Ok(b.into()),
Self::String(string) => Ok(string.to_std_string_escaped().into()),
&Self::Rational(rat) => Ok(rat.into()),
Expand Down

0 comments on commit aac8213

Please sign in to comment.