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

Expose ZoneAwareError and UncaughtPromiseError #996

Closed
trshafer opened this issue Jan 19, 2018 · 1 comment · Fixed by #1040
Closed

Expose ZoneAwareError and UncaughtPromiseError #996

trshafer opened this issue Jan 19, 2018 · 1 comment · Fixed by #1040

Comments

@trshafer
Copy link

UncaughtPromiseError provides the original error which is thrown on the rejection property:

error.rejection = value;

It would be helpful to be able to check in angular's error handler what the original error is. In order to safely check what the original error is, it would be helpful to have compiler checking on UncaughtPromiseError. Something like:

import {UncaughtPromiseError} from '@angular/zone';
import {ErrorHandler} from '@angular/core';

export class MyErrorHandler implements ErrorHandler {
  handleError(error: Error|UncaughtPromiseError) {
    if(error.rejection) {
      // do something with the original error
    }
  }
}

Zone is not exposed as an angular npm module, so that might also be a requirement.

Right now the only way to accomplish this is to duplicate the UncaughtPromiseError interface, which is error prone.

Thanks.

@trshafer trshafer changed the title expose ZoneAwareError and UncaughtPromiseError Expose ZoneAwareError and UncaughtPromiseError Jan 19, 2018
@JiaLiPassion
Copy link
Collaborator

@trshafer, thank you for the proposal, I will check it.

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

Successfully merging a pull request may close this issue.

2 participants