diff options
| author | Casper Beyer <caspervonb@pm.me> | 2021-07-07 05:33:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-06 23:33:06 +0200 |
| commit | 78ac19f51f48984ea16f97a0c574fa507544b8d5 (patch) | |
| tree | 141f8665d88f1c8f2a80af3280e620217d9d82e2 /cli/tools | |
| parent | 7edb1d713c036583e2ba3caf0df042835781a49c (diff) | |
fix(repl): do not panic when Deno.inspect throws (#11292)
Diffstat (limited to 'cli/tools')
| -rw-r--r-- | cli/tools/repl.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index 6c6d26240..662e1a8d7 100644 --- a/cli/tools/repl.rs +++ b/cli/tools/repl.rs @@ -564,7 +564,13 @@ impl ReplSession { "Runtime.callFunctionOn", Some(json!({ "executionContextId": self.context_id, - "functionDeclaration": "function (object) { return Deno[Deno.internal].inspectArgs(['%o', object], { colors: !Deno.noColor }); }", + "functionDeclaration": r#"function (object) { + try { + return Deno[Deno.internal].inspectArgs(["%o", object], { colors: !Deno.noColor }); + } catch (err) { + return Deno[Deno.internal].inspectArgs(["%o", err]); + } + }"#, "arguments": [ evaluate_result, ], |
