mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 02:22:40 +00:00
fix(cli/repl): await Promise.any([])... (#15623)
This commit is contained in:
parent
a74b2ecf37
commit
8178665bd1
4 changed files with 40 additions and 7 deletions
|
@ -165,8 +165,18 @@ impl ReplSession {
|
|||
exception_details,
|
||||
} = evaluate_response.value;
|
||||
|
||||
if exception_details.is_some() {
|
||||
Ok(if let Some(exception_details) = exception_details {
|
||||
self.set_last_thrown_error(&result).await?;
|
||||
let description = match exception_details.exception {
|
||||
Some(exception) => exception
|
||||
.description
|
||||
.unwrap_or_else(|| "Unknown exception".to_string()),
|
||||
None => "Unknown exception".to_string(),
|
||||
};
|
||||
EvaluationOutput::Error(format!(
|
||||
"{} {}",
|
||||
exception_details.text, description
|
||||
))
|
||||
} else {
|
||||
self
|
||||
.language_server
|
||||
|
@ -174,12 +184,8 @@ impl ReplSession {
|
|||
.await;
|
||||
|
||||
self.set_last_eval_result(&result).await?;
|
||||
}
|
||||
|
||||
let value = self.get_eval_value(&result).await?;
|
||||
Ok(match exception_details {
|
||||
Some(_) => EvaluationOutput::Error(format!("Uncaught {}", value)),
|
||||
None => EvaluationOutput::Value(value),
|
||||
let value = self.get_eval_value(&result).await?;
|
||||
EvaluationOutput::Value(value)
|
||||
})
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue