Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.yml

This file was deleted.

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ This module provides a set of errors based on [standard-http-error](https://www.
Install **@uphold/http-errors** with yarn:

```sh
$ yarn add @uphold/http-errors
yarn add @uphold/http-errors
```

Alternatively, with npm:

```sh
$ npm i @uphold/http-errors
npm i @uphold/http-errors
```

## Errors
Expand All @@ -34,14 +34,14 @@ try {
Below is the list of all available errors:

| Name | Code | Default message |
|:------------------------|:-----|:----------------------|
| :---------------------- | :--- | :-------------------- |
| AssertionFailedError | 500 | Internal Server Error |
| BadRequestError | 400 | Bad Request |
| ConflictError | 409 | Conflict |
| ForbiddenError | 403 | Forbidden |
| GoneError | 410 | Gone |
| NotFoundError | 404 | Not Found |
| NotImplementedError | 501 | Not Implemented
| NotImplementedError | 501 | Not Implemented |
| ServiceUnavailableError | 503 | Service Unavailable |
| TooManyRequestsError | 429 | Too Many Requests |
| UnauthorizedError | 401 | Unauthorized |
Expand All @@ -60,7 +60,7 @@ function authorize(user, permission) {
}

if (permission === 'admin' && user.role !== 'admin') {
throw new ForbiddenError('Only admins allowed', { role: 'admin' })
throw new ForbiddenError('Only admins allowed', { role: 'admin' });
}

return true;
Expand Down Expand Up @@ -113,16 +113,16 @@ try {
Use the `test` script to run the test suite:

```sh
$ yarn test
yarn test
```

To test and check coverage use the `cover` script:

```sh
$ yarn cover
yarn cover
```

A full coverage report will be generated on *test/coverage* folder.
A full coverage report will be generated on _test/coverage_ folder.

## Contributing

Expand All @@ -131,7 +131,7 @@ Please create a PR with a description of the changes, its motivation and impacte
## Release

```sh
$ yarn release [<version> | major | minor | patch]
yarn release [<version> | major | minor | patch]
```

## License
Expand Down
11 changes: 11 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Module dependencies.
*/

const uphold = require('eslint-config-uphold');

/**
* `ESLint` configuration.
*/

module.exports = uphold;
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@uphold/http-errors",
"version": "1.4.0",
"description": "Set of errors based on http-standard-error",
"description": "Set of errors based on standard-http-error",
"license": "MIT",
"author": "Uphold",
"main": "src/index.js",
"types": "types/index.d.ts",
"scripts": {
"changelog": "github-changelog-generator --future-release=v$npm_package_version > CHANGELOG.md",
"cover": "yarn test -- --coverage",
"lint": "eslint --cache src test",
"lint": "eslint",
"release": "npm version $1 -m 'Release %s'",
"test": "jest --config jest.json",
"version": "yarn changelog && git add CHANGELOG.md"
Expand All @@ -23,10 +23,11 @@
},
"devDependencies": {
"@uphold/github-changelog-generator": "^0.7.0",
"eslint": "^5.0.1",
"eslint-config-uphold": "^0.1.1",
"eslint": "^9.28.0",
"eslint-config-uphold": "^6.5.1",
"jest": "20.0.4",
"pre-commit": "1.2.2"
"pre-commit": "1.2.2",
"prettier": "^3.5.3"
},
"engines": {
"node": ">=4"
Expand Down
Loading