2.0.10 • Published 3 years ago

error-switch v2.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Introduction

Constantly having to define error cases for each API integration is a chore. This package aims to resolve this issue by adding as many specific (yet common enough) errors as possible based on our current API integrations. This formal, semantic definition of errors will allow us to reduce the time taken to integrate APIs and allows us to account for edge cases even better.

The list will continue to grow. Feel free to open a pull request to add more keys or types.

How to use

This package can be used on the server side as well as on the browser. The server can send an error message in the following format:

{
    error: errors.LOGIN_FAILED
}

The browser can then use the imported error file to understand the error semantically and deal with it in the right way.

if(res.error && res.error.name === 'LOGIN_FAILED'){
    // Do something
}
2.0.10

3 years ago

2.0.8-alpha.2

3 years ago

2.0.8-alpha.1

3 years ago

2.0.8-alpha.4

3 years ago

2.0.8-alpha.3

3 years ago

2.0.8-alpha.5

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago