(fn: Promise<T>)
| 58 | return "unknown error: " + JSON.stringify(err); |
| 59 | } |
| 60 | |
| 61 | export async function wrap<T, E = unknown>(fn: Promise<T>): Promise<[T, null] | [null, E]> { |
| 62 | return fn.then((data) => [data, null] as [T, null]).catch((err) => [null, err as unknown as E] as [null, E]); |
| 63 | } |
| 64 | |
| 65 | export function jsonHeaders(): { "content-type": "application/json" } { |
no outgoing calls
no test coverage detected