@fastify/error 2.0.0 → 3.0.0
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/.github/workflows/ci.yml +6 -37
- package/README.md +5 -6
- package/package.json +2 -2
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
1
|
name: CI
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
on:
|
|
3
4
|
push:
|
|
4
5
|
paths-ignore:
|
|
5
|
-
- docs/**
|
|
6
|
+
- 'docs/**'
|
|
6
7
|
- '*.md'
|
|
7
8
|
pull_request:
|
|
8
9
|
paths-ignore:
|
|
9
|
-
- docs/**
|
|
10
|
+
- 'docs/**'
|
|
10
11
|
- '*.md'
|
|
12
|
+
|
|
11
13
|
jobs:
|
|
12
14
|
test:
|
|
13
|
-
|
|
14
|
-
strategy:
|
|
15
|
-
matrix:
|
|
16
|
-
node-version:
|
|
17
|
-
- 10
|
|
18
|
-
- 12
|
|
19
|
-
- 14
|
|
20
|
-
- 16
|
|
21
|
-
os:
|
|
22
|
-
- macos-latest
|
|
23
|
-
- ubuntu-latest
|
|
24
|
-
- windows-latest
|
|
25
|
-
steps:
|
|
26
|
-
- uses: actions/checkout@v3
|
|
27
|
-
- name: Use Node.js
|
|
28
|
-
uses: actions/setup-node@v3
|
|
29
|
-
with:
|
|
30
|
-
node-version: ${{ matrix.node-version }}
|
|
31
|
-
- name: Install Dependencies
|
|
32
|
-
run: |
|
|
33
|
-
npm install --ignore-scripts
|
|
34
|
-
- name: Run Tests
|
|
35
|
-
run: |
|
|
36
|
-
npm test
|
|
37
|
-
automerge:
|
|
38
|
-
needs: test
|
|
39
|
-
runs-on: ubuntu-latest
|
|
40
|
-
permissions:
|
|
41
|
-
pull-requests: write
|
|
42
|
-
contents: write
|
|
43
|
-
steps:
|
|
44
|
-
- uses: fastify/github-action-merge-dependabot@v3
|
|
45
|
-
with:
|
|
46
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
15
|
+
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
|
package/README.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
# fastify
|
|
1
|
+
# @fastify/error
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-
[](https://snyk.io/test/github/fastify/fastify-error)
|
|
4
|
+
[](https://www.npmjs.com/package/@fastify/error)
|
|
6
5
|
[](https://standardjs.com/)
|
|
7
6
|
|
|
8
7
|
A small utility, used by Fastify itself, for generating consistent error objects across your codebase and plugins.
|
|
9
8
|
|
|
10
9
|
### Install
|
|
11
10
|
```
|
|
12
|
-
npm i fastify
|
|
11
|
+
npm i @fastify/error
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
### Usage
|
|
@@ -26,14 +25,14 @@ createError(code, message [, statusCode [, Base]])
|
|
|
26
25
|
- `Base` (`Error`, optional) - The base error object that will be used. (eg `TypeError`, `RangeError`)
|
|
27
26
|
|
|
28
27
|
```js
|
|
29
|
-
const createError = require('fastify
|
|
28
|
+
const createError = require('@fastify/error')
|
|
30
29
|
const CustomError = createError('ERROR_CODE', 'message')
|
|
31
30
|
console.log(new CustomError())
|
|
32
31
|
```
|
|
33
32
|
|
|
34
33
|
How to use an interpolated string:
|
|
35
34
|
```js
|
|
36
|
-
const createError = require('fastify
|
|
35
|
+
const createError = require('@fastify/error')
|
|
37
36
|
const CustomError = createError('ERROR_CODE', 'Hello %s')
|
|
38
37
|
console.log(new CustomError('world')) // error.message => 'Hello world'
|
|
39
38
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastify/error",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A small utility, used by Fastify itself, for generating consistent error objects across your codebase and plugins.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"homepage": "https://github.com/fastify/fastify-error#readme",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^17.0.0",
|
|
28
|
-
"ava": "^
|
|
28
|
+
"ava": "^4.0.1",
|
|
29
29
|
"standard": "^17.0.0",
|
|
30
30
|
"tsd": "^0.20.0",
|
|
31
31
|
"typescript": "^4.1.3"
|