(options: {
readonly try: (signal: AbortSignal) => PromiseLike<A>
readonly catch: (error: unknown) => E
})
| 1087 | * @category constructors |
| 1088 | */ |
| 1089 | export const tryPromise = <A, E>(options: { |
| 1090 | readonly try: (signal: AbortSignal) => PromiseLike<A> |
| 1091 | readonly catch: (error: unknown) => E |
| 1092 | }): Micro<A, E> => |
| 1093 | asyncOptions<A, E>(function(resume, signal) { |
| 1094 | try { |
| 1095 | options.try(signal!).then( |
| 1096 | (a) => resume(succeed(a)), |
| 1097 | (e) => resume(fail(options.catch(e))) |
| 1098 | ) |
| 1099 | } catch (err) { |
| 1100 | resume(fail(options.catch(err))) |
| 1101 | } |
| 1102 | }, options.try.length !== 0) |
| 1103 | |
| 1104 | /** |
| 1105 | * Create a `Micro` effect using the current `MicroFiber`. |
no test coverage detected
searching dependent graphs…