Method
run
(
callback: () => void,
teardown: (err: any) => void = DEFAULT_TEARDOWN,
autoFlushLogs: boolean,
)
Source from the content-addressed store, hash-verified
| 7 | private static readonly exceptionHandler = new ExceptionHandler(); |
| 8 | |
| 9 | public static run( |
| 10 | callback: () => void, |
| 11 | teardown: (err: any) => void = DEFAULT_TEARDOWN, |
| 12 | autoFlushLogs: boolean, |
| 13 | ) { |
| 14 | try { |
| 15 | callback(); |
| 16 | } catch (e) { |
| 17 | this.exceptionHandler.handle(e); |
| 18 | if (autoFlushLogs) { |
| 19 | Logger.flush(); |
| 20 | } |
| 21 | teardown(e); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | public static async asyncRun( |
| 26 | callback: () => Promise<void>, |