Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

feat(error): fix #975, can config how to load blacklist zone stack frames - #1045

Merged
mhevery merged 1 commit into
angular:masterfrom
JiaLiPassion:lazy-error
Jun 24, 2018
Merged

feat(error): fix #975, can config how to load blacklist zone stack frames#1045
mhevery merged 1 commit into
angular:masterfrom
JiaLiPassion:lazy-error

Conversation

@JiaLiPassion

@JiaLiPassionJiaLiPassion commented Mar 11, 2018

Copy link
Copy Markdown
Collaborator

fix#975.

current zone-error provide several functionality.

  1. handle class MyError extends Error, new MyError() instanceof Error will report false issue.

  2. remove zone.js internal stack trace frames.

  3. add zone information to each zone frame.

The No2 and No3. feature will slow down the new Error() performance,
So the motivation of this PR is to provide a flag to let user be able to disable No2 and No3.

The flag is __Zone_Error_BlacklistedStackFrames_policy. And the available options is:

  1. default: this is the default one, if you load zone.js/dist/zone-error without
    setting the flag, default will be used, and BlackListStackFrames will be available
    when new Error(), you can get a error.stack which is zone stack free. But this
    will slow down new Error() a little bit.

  2. disable: this will disable BlackListZoneStackFrame feature, and if you load
    zone.js/dist/zone-error, you will only get a wrapped Error which can handle
    Error inherit issue.

  3. lazy: this is a feature to let you be able to get BlackListZoneStackFrame feature,
    but not impact performance. But as a trade off, you can't get the zone free stack frames by access error.stack. You can only get it by access error.zoneAwareStack.

@JiaLiPassion
JiaLiPassionforce-pushed the lazy-error branch 2 times, most recently from f28a215 to 3c34addCompareMarch 11, 2018 11:58
@JiaLiPassionJiaLiPassion changed the title feat(error): fix #975, can config how to load blacklist zone stack framesWIP(error): fix #975, can config how to load blacklist zone stack framesMar 11, 2018
@JiaLiPassionJiaLiPassion changed the title WIP(error): fix #975, can config how to load blacklist zone stack framesfeat(error): fix #975, can config how to load blacklist zone stack framesMar 12, 2018
mhevery
mhevery previously approved these changes Mar 14, 2018
@mhevery

Copy link
Copy Markdown
Contributor

Could you resolve conflicts please?

@JiaLiPassion

Copy link
Copy Markdown
CollaboratorAuthor

@mhevery , I have resolved the conflict, the CI is red because saucelabs iphone is not available, I have checked that all cases passed, please review, thank you!

@mhevery

Copy link
Copy Markdown
Contributor

Sorry, more conflicts.

@JiaLiPassion

Copy link
Copy Markdown
CollaboratorAuthor

@mhevery , yes, the strict PR will have many conflicts with all others, I will rebase them all.

@JiaLiPassion
JiaLiPassionforce-pushed the lazy-error branch 9 times, most recently from 22af915 to 169e8c2CompareJune 22, 2018 09:15
@mhevery
mhevery merged commit ff3d545 into angular:masterJun 24, 2018
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZoneAwareError is 15-20x slower than native, should lazy-evaluate "stack"

3 participants

@JiaLiPassion@mhevery@googlebot