summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/integration/repl_tests.rs4
-rw-r--r--cli/tools/repl/session.rs12
2 files changed, 13 insertions, 3 deletions
diff --git a/cli/tests/integration/repl_tests.rs b/cli/tests/integration/repl_tests.rs
index e6fc7aa91..77a534d2e 100644
--- a/cli/tests/integration/repl_tests.rs
+++ b/cli/tests/integration/repl_tests.rs
@@ -814,6 +814,10 @@ fn repl_reject() {
console.expect(" at <anonymous>");
console.write_line("console.log(2);");
console.expect("2");
+ console.write_line(r#"throw "hello";"#);
+ console.expect(r#"Uncaught "hello""#);
+ console.write_line(r#"throw `hello ${"world"}`;"#);
+ console.expect(r#"Uncaught "hello world""#);
});
}
diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs
index 40cf7d3b0..4a30c93c4 100644
--- a/cli/tools/repl/session.rs
+++ b/cli/tools/repl/session.rs
@@ -258,9 +258,15 @@ impl ReplSession {
Ok(if let Some(exception_details) = exception_details {
session.set_last_thrown_error(&result).await?;
let description = match exception_details.exception {
- Some(exception) => exception
- .description
- .unwrap_or_else(|| "undefined".to_string()),
+ Some(exception) => {
+ if let Some(description) = exception.description {
+ description
+ } else if let Some(value) = exception.value {
+ value.to_string()
+ } else {
+ "undefined".to_string()
+ }
+ }
None => "Unknown exception".to_string(),
};
EvaluationOutput::Error(format!(