-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2023 from FaberVitale/feat/alm-improve-task-abort…
…-error
- Loading branch information
Showing
7 changed files
with
152 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
export class TaskAbortError implements Error { | ||
import type { SerializedError } from '@reduxjs/toolkit' | ||
|
||
const task = 'task' | ||
const listener = 'listener' | ||
const completed = 'completed' | ||
const cancelled = 'cancelled' | ||
|
||
/* TaskAbortError error codes */ | ||
export const taskCancelled = `${task}-${cancelled}` as const | ||
export const taskCompleted = `${task}-${completed}` as const | ||
export const listenerCancelled = `${listener}-${cancelled}` as const | ||
export const listenerCompleted = `${listener}-${completed}` as const | ||
|
||
export class TaskAbortError implements SerializedError { | ||
name = 'TaskAbortError' | ||
message = '' | ||
constructor(public reason = 'unknown') { | ||
this.message = `task cancelled (reason: ${reason})` | ||
constructor(public code = 'unknown') { | ||
this.message = `task cancelled (reason: ${code})` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters