| // Generic promise error handler | |
| function F_catch_promise<T>(arg0: { | |
| promise: Promise<T>; | |
| }): Promise<[undefined, T] | [Error, undefined]> { | |
| const { promise } = arg0; | |
| let final_promise = promise; | |
| const promise_resolver = final_promise | |
| .then((data) => { | |
| return [undefined, data] as [undefined, T]; | |
| }) | |
| .catch((error) => { | |
| return [error, undefined] as [Error, undefined]; | |
| }); | |
| return promise_resolver; | |
| } | |
| export const NS_promise = { | |
| F_catch_promise, | |
| }; | |