Name signers after nips

This commit is contained in:
Jon Staab
2024-08-08 11:43:29 -07:00
parent 536c8123f4
commit a8d0f5bc4f
9 changed files with 132 additions and 124 deletions
+8 -2
View File
@@ -121,9 +121,15 @@ export const toggle = <T>(x: T, xs: T[]) => xs.includes(x) ? remove(x, xs) : app
export const clamp = ([min, max]: [number, number], n: number) => Math.min(max, Math.max(min, n))
export const tryCatch = async <T>(f: () => Promise<T | void> | T | void, onError?: (e: Error) => void): Promise<T | void> => {
export const tryCatch = <T>(f: () => T, onError?: (e: Error) => void): T | undefined => {
try {
return await f()
const r = f()
if (r instanceof Promise) {
r.catch(e => onError?.(e as Error))
}
return r
} catch (e) {
onError?.(e as Error)
}