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

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 {}

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ry ry merged commit 2f0f236 into denoland:master Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants