mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
fix(repl): correctly print string exception (#19391)
Fixes a recent regression where `throw "hello"` in the repl prints `Uncaught undefined` instead of `throw "hello"`
This commit is contained in:
parent
40d77c5605
commit
455b0eb8bb
2 changed files with 13 additions and 3 deletions
|
@ -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!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue