-
Notifications
You must be signed in to change notification settings - Fork 133
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 #1374 from canalplus/feat/attach-worker-prom
Make `attachWorker` return a promise
- Loading branch information
Showing
5 changed files
with
148 additions
and
14 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import errorMessage from "./error_message"; | ||
|
||
type IWorkerInitializationErrorCode = "UNKNOWN_ERROR" | | ||
"SETUP_ERROR" | | ||
"INCOMPATIBLE_ERROR"; | ||
|
||
/** | ||
* Error linked to the WebWorker initialization. | ||
* | ||
* @class WorkerInitializationError | ||
* @extends Error | ||
*/ | ||
export default class WorkerInitializationError extends Error { | ||
public readonly name : "WorkerInitializationError"; | ||
public readonly type : "WORKER_INITIALIZATION_ERROR"; | ||
public readonly message : string; | ||
public readonly code : IWorkerInitializationErrorCode; | ||
|
||
/** | ||
* @param {string} code | ||
* @param {string} message | ||
*/ | ||
constructor( | ||
code : IWorkerInitializationErrorCode, | ||
message : string | ||
) { | ||
super(); | ||
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class | ||
Object.setPrototypeOf(this, WorkerInitializationError.prototype); | ||
|
||
this.name = "WorkerInitializationError"; | ||
this.type = "WORKER_INITIALIZATION_ERROR"; | ||
this.code = code; | ||
this.message = errorMessage(this.code, message); | ||
} | ||
} |
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