Skip to content

1.3.0

Latest
Compare
Choose a tag to compare
@musicq musicq released this 19 May 04:09

New Features

  • New API to change default exit behavior.

By default, in Node, panic will exit the program. You can set exit to false to prevent this behavior. Sometimes this might be annoying if you want to handle the errors and do some cleanup stuff.

Now you can use setShouldExitByDefault to prevent the program exit by default in Node.

import { setShouldExitByDefault } from 'panicit'

setShouldExitByDefault(false)

// this won't exit the program
panic('some error')

// you can still exit the program by set `exit` to `true` explicitly
panic('some error', { exit: true })