Skip to content

Commit

Permalink
fix(action): fixed abort message typo
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcourtice committed Feb 17, 2022
1 parent 82b1b7c commit e49d77e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions extensions/action/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import {
getAbortMessage,
} from './utilities';

export class ActionAbortError extends Error {
public name: string;
public instanceId: symbol;
public reason?: unknown;

constructor(name: string, instanceId: symbol, reason: unknown = 'unknown') {
super(`Action ${name} as been cancelled. Reason: ${reason}`);
constructor(name: string, instanceId: symbol, reason?: unknown) {
super(getAbortMessage(name, reason));

this.name = name;
this.instanceId = instanceId;
Expand Down
6 changes: 5 additions & 1 deletion extensions/action/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import {
ActionAbortError,
} from './errors';

import {
getAbortMessage,
} from './utilities';

import type {
Action,
ActionAbortStrategies,
Expand All @@ -44,7 +48,7 @@ export const ABORT_STRATEGY = {
reject(new ActionAbortError(name, id, reason));
},
warn: (name, id, resolve, reject, reason) => {
console.warn(`Action ${name} has been cancelled. Reason: ${reason || 'unknown'}`);
console.warn(getAbortMessage(name, reason));
resolve();
},
} as ActionAbortStrategies;
Expand Down
3 changes: 3 additions & 0 deletions extensions/action/src/utilities.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getAbortMessage(name: string, reason: unknown) {
return `Action ${name} has been cancelled. Reason: ${reason || 'unknown'}`;
}

0 comments on commit e49d77e

Please sign in to comment.