« get me outta code hell

exception.js « util - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/util/exception.js
blob: e88ff997cbbacea7044ebb1c21e08b393a7dbfb3 (plain)
1
2
3
4
5
6
7
module.exports = function exception(code, message) {
  // Makes a custom error with the given code and message.

  const err = new Error(`${code}: ${message}`)
  err.code = code
  return err
}