@malijs/onerror
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

@malijs/onerror

Mali on error middleware. Calls function with error and context. The called function does not have access to control flow.

npm version build status

API

@malijs/onerror ⇒ function

Mali on error middleware. Calls function with error and context. The called function does not have access to control flow.

Returns: function - the middleware function

Param Type Description
fn function The function to call when an error occurs. Function has to have signature with signature (err, ctx)

Example

const onError = require('@malijs/onerror')

function errorLogger (err, ctx) {
  console.log('Error on %s: %s', ctx.name, err.toString())
}

app.use(onError(errorLogger))

License

Apache-2.0

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.3.1
    619
    • latest
  • 0.4.0
    37
    • undefined

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.4.0
    37
  • 0.3.1
    619
  • 0.3.0
    1

Package Sidebar

Install

npm i @malijs/onerror

Weekly Downloads

330

Version

0.3.1

License

Apache-2.0

Unpacked Size

15.5 kB

Total Files

6

Last publish

Collaborators

  • anonrig
  • bojand