diff --git a/core/engine/src/value/conversions/serde_json.rs b/core/engine/src/value/conversions/serde_json.rs index 104d928e7c9..ffee5a55d06 100644 --- a/core/engine/src/value/conversions/serde_json.rs +++ b/core/engine/src/value/conversions/serde_json.rs @@ -115,7 +115,9 @@ impl JsValue { pub fn to_json(&self, context: &mut Context) -> JsResult { 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()),