@mongodb-js/compass-utils
Advanced tools
Comparing version 0.0.0-next-4a16c562be330c2a9b95f216435d982a1dcb3674 to 0.0.0-next-4b81a9b6e20eb7c3a0b90e00908cae169255f043
declare class AbortError extends Error { | ||
constructor(); | ||
constructor(message?: string); | ||
name: string; | ||
} | ||
export declare const throwIfAborted: (signal?: AbortSignal) => void; | ||
export declare const createCancelError: () => AbortError; | ||
export declare const throwIfAborted: (signal?: { | ||
aborted: boolean; | ||
reason?: Error; | ||
}) => void; | ||
export declare const createCancelError: (message?: string) => AbortError; | ||
export declare function isCancelError(error: any): error is AbortError; | ||
@@ -8,0 +11,0 @@ export declare function raceWithAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>; |
@@ -5,4 +5,4 @@ "use strict"; | ||
class AbortError extends Error { | ||
constructor() { | ||
super('This operation was aborted'); | ||
constructor(message) { | ||
super(message ?? 'This operation was aborted'); | ||
this.name = 'AbortError'; | ||
@@ -17,6 +17,15 @@ } | ||
exports.throwIfAborted = throwIfAborted; | ||
const createCancelError = () => { | ||
const createCancelError = (message) => { | ||
const controller = new AbortController(); | ||
controller.abort(); | ||
return controller.signal.reason ?? new AbortError(); | ||
if (message && controller.signal.reason) { | ||
Object.defineProperty(controller.signal.reason, 'message', { | ||
get() { | ||
return message; | ||
}, | ||
configurable: true, | ||
enumerable: true, | ||
}); | ||
} | ||
return controller.signal.reason ?? new AbortError(message); | ||
}; | ||
@@ -23,0 +32,0 @@ exports.createCancelError = createCancelError; |
@@ -16,3 +16,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/compass", | ||
"version": "0.0.0-next-4a16c562be330c2a9b95f216435d982a1dcb3674", | ||
"version": "0.0.0-next-4b81a9b6e20eb7c3a0b90e00908cae169255f043", | ||
"repository": { | ||
@@ -54,6 +54,6 @@ "type": "git", | ||
"devDependencies": { | ||
"@mongodb-js/eslint-config-compass": "0.0.0-next-4a16c562be330c2a9b95f216435d982a1dcb3674", | ||
"@mongodb-js/mocha-config-compass": "0.0.0-next-4a16c562be330c2a9b95f216435d982a1dcb3674", | ||
"@mongodb-js/prettier-config-compass": "0.0.0-next-4a16c562be330c2a9b95f216435d982a1dcb3674", | ||
"@mongodb-js/tsconfig-compass": "0.0.0-next-4a16c562be330c2a9b95f216435d982a1dcb3674", | ||
"@mongodb-js/eslint-config-compass": "0.0.0-next-4b81a9b6e20eb7c3a0b90e00908cae169255f043", | ||
"@mongodb-js/mocha-config-compass": "0.0.0-next-4b81a9b6e20eb7c3a0b90e00908cae169255f043", | ||
"@mongodb-js/prettier-config-compass": "0.0.0-next-4b81a9b6e20eb7c3a0b90e00908cae169255f043", | ||
"@mongodb-js/tsconfig-compass": "0.0.0-next-4b81a9b6e20eb7c3a0b90e00908cae169255f043", | ||
"@types/chai": "^4.2.21", | ||
@@ -74,5 +74,5 @@ "@types/mocha": "^9.0.0", | ||
"@electron/remote": "^2.1.2", | ||
"electron": "^29.4.2" | ||
"electron": "^30.4.0" | ||
}, | ||
"gitHead": "4a16c562be330c2a9b95f216435d982a1dcb3674" | ||
"gitHead": "4b81a9b6e20eb7c3a0b90e00908cae169255f043" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
46490
159
+ Addedelectron@30.5.1(transitive)
- Removedelectron@29.4.6(transitive)
Updatedelectron@^30.4.0