8000 GitHub - eeston/onerror: On error middleware for Mali
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

eeston/onerror

 
 

Repository files navigation

@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

About

On error middleware for Mali

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0