-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
3,161 additions
and
7,013 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,5 @@ | ||
node_modules | ||
.idea | ||
|
||
node_modules | ||
dist | ||
coverage | ||
|
||
experiment | ||
*.ignore.ts |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,29 +1,30 @@ | ||
export default class CancellationError { | ||
constructor( | ||
public readonly reason?: any, | ||
) {} | ||
) { | ||
} | ||
|
||
public static async ignoreAsync<T>(promise: () => Promise<T>): Promise<T|undefined> { | ||
public static async ignoreAsync<T>(promise: () => Promise<T>): Promise<T | undefined> { | ||
try { | ||
return await promise() | ||
} catch (error) { | ||
if (error instanceof CancellationError) { | ||
return | ||
} | ||
|
||
throw error | ||
} | ||
} | ||
|
||
public static ignoreSync<T>(func: () => T): T|undefined { | ||
public static ignoreSync<T>(func: () => T): T | undefined { | ||
try { | ||
return func() | ||
} catch (error) { | ||
if (error instanceof CancellationError) { | ||
return | ||
} | ||
|
||
throw error | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.