This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
fix #595, #427, #602, refactor ZoneAwareError property copy logic #597
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #595,#427.
In previous PR to fix #546, we copy every property from NativeError to this (ZoneAwareError) with following logic.
and such logic will have conflict with following angular2 BaseError logic.
BaseError has such hack logic to make sure
this
is used.because BaseError's constructor will call super , and super will call copy, copy will then call
BaseError's setter, but this._nativeError is still undefined, so it will cause Exception.
In this PR, instead of copy property values with assignAll, I create propertyDescriptor to delegate to native error.
And because ZoneAwareError already handle Error
this
constructor issue, maybe in the future, angular2 BaseError don't need to handle such issue again.angular/angular#13908