# fashy-errors

> An npm package designed to streamline error handling in Node.js/Express Applications.

Latest version **0.0.3** (published 2023-02-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install fashy-errors
pnpm add fashy-errors
yarn add fashy-errors
bun add fashy-errors
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-02-21 |
| First published | 2023-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kenechukwu Arionye |
| Maintainers | augustinekacee |
| Keywords | Errors, Error handler, Middleware, Express, Nodejs, Javascript, Typescript |

## Links

- npm: https://www.npmjs.com/package/fashy-errors
- Repository: https://github.com/kenechiaugustine/fashy-errors
- Homepage: https://github.com/kenechiaugustine/fashy-errors#readme
- Issues: https://github.com/kenechiaugustine/fashy-errors/issues
- npm.io page: https://npm.io/package/fashy-errors

## Dependencies (1)

- [express](https://npm.io/package/express.md) ^4.18.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-02-21
- 0.0.2 — 2023-02-21

## README

# Fashy Errors

Fashy Errors is an npm package that provides a simple way to handle errors in your Node.js / Express application.

# Installation

This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):

```sh
$ npm install fashy-errors
```

# Usage

## Simple Usage (Enable _fashy-errors_ Global Error Handler Middleware)

To use Fashy Errors as the global error handler middleware in your Express application, you can simply import the _GlobalErrorHandler_ function from the package and use it as middleware:

```javascript
const express = require('express');
const { GlobalErrorHandler } = require('fashy-errors');

const app = express();

app.get('/', (req, res, next) => {
  res.json({
    status: 'success',
    message: 'Hello world',
  });
});

// Global Error Handler Middleware
app.use(GlobalErrorHandler);

app.listen(4000, () => console.log(`Server running`));
```

## Using Custom Errors

You can also create and use custom errors in your application by importing the _CustomError_ class from the package and throwing a new error with it:

```javascript
const { CustomError } = require('fashy-errors');

app.all('*', (req, res, next) => {
  // Custom Error Message
  throw new CustomError('Page not found !!!', 404);
});
```

## Contribution

Contributions to this project are welcome 🤗. Feel free to open issues and submit pull requests.

## License

Fashy Errors is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php). See the LICENSE file for more information.

## Author

Fashy Errors is developed by [Kenechukwu Arionye](https://github.com/kenechiaugustine). You can contact me at [kenechiaugustine@gmail.com](mailto:kenechiaugustine@gmail.com)

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