Skip to content

Commit

Permalink
feat(Rejection): Add $id to ease debugging of transition rejections
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Feb 23, 2017
1 parent 16220db commit d456d54
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/transition/rejectFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export enum RejectType {
SUPERSEDED = 2, ABORTED = 3, INVALID = 4, IGNORED = 5, ERROR = 6
}

/** @hidden */ let id = 0;

export class Rejection {
$id = id++;
type: number;
message: string;
detail: any;
Expand All @@ -25,8 +28,9 @@ export class Rejection {
toString() {
const detailString = (d: any) =>
d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d);
let type = this.type, message = this.message, detail = detailString(this.detail);
return `TransitionRejection(type: ${type}, message: ${message}, detail: ${detail})`;
let detail = detailString(this.detail);
let { $id, type, message } = this;
return `TransitionRejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;
}

toPromise(): Promise<any> {
Expand Down

0 comments on commit d456d54

Please sign in to comment.