summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
authorJason <m.jason.liu@outlook.com>2022-09-02 19:38:06 +0800
committerGitHub <noreply@github.com>2022-09-02 13:38:06 +0200
commit8178665bd1877a55a4e82b07d6ac4a749c8a9c1c (patch)
tree74ba2bf20abbe3ba44080b9177489ff117b097f7 /cli/tools
parenta74b2ecf379ddb1ff03c61d4e876153d7b4c45d2 (diff)
fix(cli/repl): await Promise.any([])... (#15623)
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/repl/session.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs
index d5058ab72..f2cdfe568 100644
--- a/cli/tools/repl/session.rs
+++ b/cli/tools/repl/session.rs
@@ -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) => {