# mali-onerror

> On error middleware for Mali

Latest version **0.2.0** (published 2018-11-15) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install mali-onerror
pnpm add mali-onerror
yarn add mali-onerror
bun add mali-onerror
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2018-11-15 |
| First published | 2016-12-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bojan D. |
| Maintainers | bojand |
| Keywords | mali, grpc, service, server, microservice |

## Links

- npm: https://www.npmjs.com/package/mali-onerror
- Repository: https://github.com/malijs/onerror
- Issues: https://github.com/malijs/onerror/issues
- npm.io page: https://npm.io/package/mali-onerror

## Dependencies (2)

- [error-inject](https://npm.io/package/error-inject.md) ^1.0.0
- [mali-call-types](https://npm.io/package/mali-call-types.md) ^0.1.0

## Recent versions

- 0.2.0 (latest) — 2018-11-15
- 0.1.1 — 2016-12-30
- 0.1.0 — 2016-12-30

## README

# mali-onerror

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

[![npm version](https://img.shields.io/npm/v/mali-onerror.svg?style=flat-square)](https://www.npmjs.com/package/mali-onerror)
[![build status](https://img.shields.io/travis/malijs/onerror/master.svg?style=flat-square)](https://travis-ci.org/malijs/onerror)
[![Greenkeeper badge](https://badges.greenkeeper.io/malijs/onerror.svg)](https://greenkeeper.io/)

## API

<a name="module_mali-onerror"></a>

### mali-onerror ⇒ <code>function</code>
Mali on error middleware. Calls function with error and context. The called function does not
have access to control flow.

**Returns**: <code>function</code> - the middleware function  

| Param | Type | Description |
| --- | --- | --- |
| fn | <code>function</code> | The function to call when an error occurs. Function has to have signature                       with signature <code>(err, ctx)</code> |

**Example**  
```js
const onError = require('mali-onerror')

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

app.use(onError(errorLogger))
```
## License

  Apache-2.0

---
_Source: https://npm.io/package/mali-onerror · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
