Skip to content
This repository has been 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
merged 1 commit into from
Jun 24, 2018

Conversation

JiaLiPassion
Copy link
Collaborator

@JiaLiPassion JiaLiPassion commented Mar 11, 2018

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 JiaLiPassion force-pushed the lazy-error branch 2 times, most recently from f28a215 to 3c34add Compare March 11, 2018 11:58
@JiaLiPassion JiaLiPassion changed the title feat(error): fix #975, can config how to load blacklist zone stack frames WIP(error): fix #975, can config how to load blacklist zone stack frames Mar 11, 2018
@JiaLiPassion JiaLiPassion changed the title WIP(error): fix #975, can config how to load blacklist zone stack frames feat(error): fix #975, can config how to load blacklist zone stack frames Mar 12, 2018
mhevery
mhevery previously approved these changes Mar 14, 2018
@mhevery
Copy link
Contributor

mhevery commented Mar 14, 2018

Could you resolve conflicts please?

@JiaLiPassion
Copy link
Collaborator Author

@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
Contributor

mhevery commented Jun 18, 2018

Sorry, more conflicts.

@JiaLiPassion
Copy link
Collaborator Author

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

@JiaLiPassion JiaLiPassion force-pushed the lazy-error branch 9 times, most recently from 22af915 to 169e8c2 Compare June 22, 2018 09:15
@mhevery mhevery merged commit ff3d545 into angular:master Jun 24, 2018
Sign up for free to 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