# @huz-com/error-core

> Abstract error & error helper

Latest version **1.0.17** (published 2021-11-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @huz-com/error-core
pnpm add @huz-com/error-core
yarn add @huz-com/error-core
bun add @huz-com/error-core
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.17 |
| Published | 2021-11-29 |
| First published | 2021-02-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 27.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mustafa Yelmer |
| Maintainers | demiremrece, mustafayelmer, e.buyuk |
| Keywords | error, exception, EDD |

## Links

- npm: https://www.npmjs.com/package/@huz-com/error-core
- Repository: git@gitlab.azerdev.com:huz.byorbit/be/component/error-core
- npm.io page: https://npm.io/package/@huz-com/error-core

## Dependencies (1)

- [stacktrace-parser](https://npm.io/package/stacktrace-parser.md) ^0.1.10

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.17 (latest) — 2021-11-29
- 1.0.16 — 2021-06-30
- 1.0.15 — 2021-05-07
- 1.0.14 — 2021-05-07
- 1.0.12 — 2021-02-20
- 1.0.11 — 2021-02-19
- 1.0.10 — 2021-02-12
- 1.0.9 — 2021-02-12
- 1.0.8 — 2021-02-10
- 1.0.7 — 2021-02-06
- 1.0.6 — 2021-02-06
- 1.0.5 — 2021-02-06
- 1.0.3 — 2021-02-06
- 1.0.2 — 2021-02-06
- 1.0.1 — 2021-02-05

## README

# Huz.Com > Component > Error Core

- Abstract error
- Error helper for error, and log

## Standards
- Language: `TS`
- Eslint: `Yes`
- Static Code Analysis: `Yes` *IntelliJ Code Inspections*
- DDD - Document Driven: `Yes`
- EDD - Exception Driven: `Yes`
- TDD - Test Driven: `Yes` [go to test folder](./test/)
- Standards Complied: [Huz Standards](https://gitlab.azerdev.com/huz.byorbit/be/documentation/standards)

## Commands
- ``npm run clear`` *// clears "dist" folder*
- ``npm run lint`` *// runs eslint for static code analysis*
- ``npm run test`` *// runs test files in "test" folder*
- ``npm run build`` *// builds JS files at "dist" folder*
- ``npm publish`` *or* ``npm run publix`` *// publishes "dist" folder to npm*

## Install
``npm i @huz-com/error-core``

## Sample
````typescript
const {AbstractError} = require('@huz-com/error-core');
export class GameNotFoundError extends AbstractError {
    status = 404;
    constructor(id: string|number) {
        // signature: (message: string, parameters?: Record<string, unknown>)
        super(`Game record could not be found with id: ${id}`, {id});
    }
}

// when error raised
throw new GameNotFoundError(345321);


// when using error object
const err = new GameNotFoundError('abc01');
console.log(err);
// It prints
/*
{
    // inherited from Error
    name: 'GameNotFoundError',
    // inherited from Error
    message: 'Game record could not be found with id: abc01',
    // inherited from AbstractError
    parameters: {
        id: 'abc01'
    },
    // GameNotFoundError custom property
    status: 404
}
*/
console.log(err instanceof Error); // true, because inherited from JS core Error
console.log(err instanceof AbstractError); // true, because inherited from AbstractError
console.log(err instanceof GameNotFoundError); // true
````

---
_Source: https://npm.io/package/@huz-com/error-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
