Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent customInspect error from crashing console #3226

Merged
merged 1 commit into from Oct 28, 2019

Conversation

@kevinkassimo
Copy link
Contributor

kevinkassimo commented Oct 28, 2019

Add a try-catch and allow fallback stringify for customInspect.

A current crashing example is inspection towards Headers.prototype. This PR fixes this:

Before:

> Headers.prototype
error: Uncaught TypeError: Cannot read property 'size' of undefined
► $deno$/headers.ts:90:38
    at [Deno.customInspect] ($deno$/headers.ts:90:38)
    at createObjectString ($deno$/console.ts:330:40)
    at stringify ($deno$/console.ts:143:14)
    at stringifyArgs ($deno$/console.ts:462:14)
    at replLog ($deno$/repl.ts:18:14)
    at evaluate ($deno$/repl.ts:89:5)
    at replLoop ($deno$/repl.ts:176:13)

After:

> Headers.prototype
HeadersBase {}
@ry
ry approved these changes Oct 28, 2019
Copy link
Collaborator

ry left a comment

LGTM

@ry ry merged commit 2f0f236 into denoland:master Oct 28, 2019
10 checks passed
10 checks passed
test macOS-10.14
Details
test_std macOS-10.14
Details
test windows-2019
Details
test_std windows-2019
Details
test ubuntu-16.04
Details
test_debug ubuntu-16.04
Details
test_std ubuntu-16.04
Details
bench ubuntu-16.04
Details
lint ubuntu-16.04
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.