Skip to content

Commit

Permalink
Adding promiseCatchHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
lathonez committed Feb 18, 2016
1 parent 5af7958 commit 0621169
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { AbstractControl } from 'angular2/common';

export class Utils {

public static promiseCatchHandler(err: Error): void {
console.error('ERROR - An error has occurred inside a promise!');
// throw the error out to the console - http://stackoverflow.com/a/30741722
setTimeout(function(): void { throw err; });
}

// bit of a hack here to reset the validation / state on the control as well as the value
// expecting a Control.reset() method to do this but there doesn't seem to be one
// http://stackoverflow.com/questions/33084280/how-to-reset-control-value
Expand Down

0 comments on commit 0621169

Please sign in to comment.