# nuxt-client-error

> A module for nuxtjs. This manage errors on client-side (such as ajax error response)

Latest version **0.0.2** (published 2019-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install nuxt-client-error
pnpm add nuxt-client-error
yarn add nuxt-client-error
bun add nuxt-client-error
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-11-19 |
| First published | 2019-11-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | shinryak |
| Maintainers | minhchi3103 |
| Keywords | nuxtjs, error, error-manage, client, ajax |

## Links

- npm: https://www.npmjs.com/package/nuxt-client-error
- Repository: https://github.com/minhchi3103/nuxt-client-error
- Homepage: https://github.com/minhchi3103/nuxt-client-error#readme
- Issues: https://github.com/minhchi3103/nuxt-client-error/issues
- npm.io page: https://npm.io/package/nuxt-client-error

## 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

- 0.0.2 (latest) — 2019-11-19
- 0.0.1 — 2019-11-18

## README

# nuxt-client-error
### Description
A module for nuxtjs that manage client-side errors in runtime. Make it easier for catching and show exception messages by binding them to component.
### How to use
#### Install
With NPM  
`npm install nuxt-client-error`  
With Yarn  
`yarn add nuxt-client-error`  
#### Add module to nuxt.config.js
Firstly, you need to add `nuxt-client-error` to your Nuxt config.
```javascript
// nuxt.config.js

{
  modules: [
    'nuxt-global-var',
    ...
  ]
}
```
#### Add an error message
You can add an error like below
```javascript
<script>
export default {
  ...
  methods:{
    awesome: function(){
      try {
        // do somethings here
      } catch (error) {
        let timeToLive = 3000
        // after 3(s), auto remove 
        // all of this error type
        this.$errors.addError('error-type', 'error-message', timeToLive)
        // If you don't want auto remove,
        // dont't set timeToLive param or set timeToLive = 0
      }
    }
  }
}
</script>
```
#### Check if error-type has any massages and show list of error messages
```html
<div v-if="$errors.hasError('error-type')">
    <p  v-for="(item, index) in $errors.getErrorMessageList('error-type')"
        :key="index">
            {{ item }}
    </p>
</div>
```
#### Remove all errors of error-type when click a button
```html
<button @click="$errors.removeError('error-type')">
        remove error
</button>
```
### Licence
[MIT License](https://github.com/minhchi3103/nuxt-client-error/blob/master/LICENSE "MIT License")

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