π¨defineWrapConfig
Set Panic By Default
(await wrap(Promise.reject('error'))).unwrap({panic: true})import {defineWrapConfig} from 'unwrapit'
defineWrapConfig({panic: true})Customize Panic Function
(message: any, opt?: {cause?: any; shouldExit?: boolean; exitCode?: number}) => neverimport {defineWrapConfig} from 'unwrapit'
class MyError extends Error {}
function myPanic(message: any): never {
throw new MyError(message)
}
defineWrapConfig({panicFn: myPanic})Last updated