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

#9166 Wrap error reason #9175

Closed
wants to merge 1 commit into from
Closed

Conversation

uuggene
Copy link

@uuggene uuggene commented Nov 21, 2017

It removes not serializable properties from 'reason' object.
They were added by ZoneAwarePromise used in NgZone and Angular 2+
Following object can not be serialized:
reason { message:'Missing PDF "http://localhost:8000/pdf-test2.pdf".', name:'MissingPDFException', __zone_symbol__currentTask:ZoneTask {_zone: Zone, runCount: 0, _zoneDelegates: null, _state: "notScheduled", ... }

By using 'wrapReason' it's converted to:
reason { message:'Missing PDF "http://localhost:8000/pdf-test2.pdf".', name:'MissingPDFException' }

Before these changes we have 2 exceptions:
ERROR Error: Uncaught (in promise): DataCloneError: Failed to execute 'postMessage' on 'Worker': function (delegate, current, target, task, applyThis, applyArgs) { try { onEnter(zo...<omitted>... } could not be cloned. Error: Failed to execute 'postMessage' on 'Worker': function (delegate, current, target, task, applyThis, applyArgs) { try { onEnter(zo...<omitted>... } could not be cloned. at eval (util.js:1309) at ZoneDelegate.invoke (zone.js:392) at Object.onInvoke (ng_zone.ts:296) at ZoneDelegate.invoke (zone.js:391) at Zone.run (zone.js:142) at zone.js:873 at ZoneDelegate.invokeTask (zone.js:425) at Object.onInvokeTask (ng_zone.ts:288) at ZoneDelegate.invokeTask (zone.js:424) at Zone.runTask (zone.js:192) at eval (util.js:1309) at ZoneDelegate.invoke (zone.js:392) at Object.onInvoke (ng_zone.ts:296) at ZoneDelegate.invoke (zone.js:391) at Zone.run (zone.js:142) at zone.js:873 at ZoneDelegate.invokeTask (zone.js:425) at Object.onInvokeTask (ng_zone.ts:288) at ZoneDelegate.invokeTask (zone.js:424) at Zone.runTask (zone.js:192) at resolvePromise (zone.js:824) at zone.js:876 at ZoneDelegate.invokeTask (zone.js:425) at Object.onInvokeTask (ng_zone.ts:288) at ZoneDelegate.invokeTask (zone.js:424) at Zone.runTask (zone.js:192) at drainMicroTaskQueue (zone.js:602) at <anonymous>

ERROR Error: Uncaught (in promise): DataCloneError: Failed to execute 'postMessage' on 'Worker': function (delegate, current, target, task, applyThis, applyArgs) { try { onEnter(zo...<omitted>... } could not be cloned. Error: Failed to execute 'postMessage' on 'Worker': function (delegate, current, target, task, applyThis, applyArgs) { try { onEnter(zo...<omitted>... } could not be cloned. at MessageHandler.postMessage (util.js:1329) at sendStreamRequest (util.js:1457) at Object.error (util.js:1494) at eval (api.js:1573) at ZoneDelegate.invoke (zone.js:392) at Object.onInvoke (ng_zone.ts:296) at ZoneDelegate.invoke (zone.js:391) at Zone.run (zone.js:142) at zone.js:873 at ZoneDelegate.invokeTask (zone.js:425) at MessageHandler.postMessage (util.js:1329) at sendStreamRequest (util.js:1457) at Object.error (util.js:1494) at eval (api.js:1573) at ZoneDelegate.invoke (zone.js:392) at Object.onInvoke (ng_zone.ts:296) at ZoneDelegate.invoke (zone.js:391) at Zone.run (zone.js:142) at zone.js:873 at ZoneDelegate.invokeTask (zone.js:425) at resolvePromise (zone.js:824) at zone.js:876 at ZoneDelegate.invokeTask (zone.js:425) at Object.onInvokeTask (ng_zone.ts:288) at ZoneDelegate.invokeTask (zone.js:424) at Zone.runTask (zone.js:192) at drainMicroTaskQueue (zone.js:602) at <anonymous>

@yurydelendik
Copy link
Contributor

yurydelendik commented Nov 21, 2017

Sorry, If I did something wrong, this is my first pull request in github.

Thanks for the PR -- it looks reasonable. Can you provide description? I would like to know how particular state is achieved. There are two independent changes and I'm curious if they are both needed.

@snovos
Copy link

snovos commented Dec 16, 2017

@yurydelendik Could you please tell me when this PR will be merged?

@Snuffleupagus
Copy link
Collaborator

Snuffleupagus commented Dec 16, 2017

@yurydelendik Could you please tell me when this PR will be merged?

I (obviously) cannot speak for Yury here, but to me it seems like the questions from #9175 (comment) remain unanswered:

Can you provide description? I would like to know how particular state is achieved. There are two independent changes and I'm curious if they are both needed.

The information provided in #9175 (comment) only contains error stacks, but no information about how those errors were actually triggered (which is what was asked above).

@uuggene
Copy link
Author

uuggene commented Dec 19, 2017

@yurydelendik I updated description as you asked. Is it clear now?
I explained how to reproduce this error in issue description.
#9166

@Snuffleupagus
Copy link
Collaborator

It appears that this is now in the process of being fixed in Angular, see issue angular/zone.js#979 and PR angular/zone.js#980.

@snovos
Copy link

snovos commented Dec 19, 2017

@uuggene So until fix is merged and new patch will be released, you can point to fix branch in your package.json

"zone.js": "JiaLiPassion/zone.js#jsondist"

@timvandermeij
Copy link
Contributor

timvandermeij commented Dec 30, 2017

This is now fixed and released upstream in Angular's Zone.js 0.8.19. External libraries should never modify our objects, so let's close this PR because it's not intended behavior. If we run into this again, we can always revisit it. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants