backend-error 0.0.5 β 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
Simple logging
|
|
6
6
|
|
|
7
7
|
<img alt="GitHub package.json version (master)" src="https://img.shields.io/github/package-json/v/eriksturesson/backendError/master">
|
|
8
|
-
<img alt="npm" src="https://img.shields.io/npm/dy
|
|
8
|
+
<img alt="npm" src="https://img.shields.io/npm/dy/backend-error?label=npm%20downloads">
|
|
9
9
|
|
|
10
10
|
</center>
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install
|
|
15
|
+
npm install backend-error
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## π₯ Custom BackendError class
|
|
@@ -22,7 +22,7 @@ Use `BackendError` class for standardized backend error handling:
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import { BackendError } from "
|
|
25
|
+
import { BackendError } from "backend-error";
|
|
26
26
|
|
|
27
27
|
throw BackendError.BadRequest("Missing required field");
|
|
28
28
|
```
|
|
@@ -53,7 +53,7 @@ You can extend it for custom domains too.
|
|
|
53
53
|
## π§ Example: With Express + showUser handling
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
|
-
import { BackendError } from "
|
|
56
|
+
import { BackendError } from "backend-error";
|
|
57
57
|
|
|
58
58
|
app.get("/user/:id", async (req, res, next) => {
|
|
59
59
|
try {
|
|
@@ -95,7 +95,7 @@ Itβs designed to be simple and universal β you can use it with any framework
|
|
|
95
95
|
π§ Example usage
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
|
-
import { BackendError, httpErrorFormatter } from "
|
|
98
|
+
import { BackendError, httpErrorFormatter } from "backend-error";
|
|
99
99
|
|
|
100
100
|
try {
|
|
101
101
|
throw BackendError.Internal("Something went very wrong."); // π your static factory pattern
|
package/package.json
CHANGED