Skip to content

Commit

Permalink
Update README with error type defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
knor-el-snor committed Mar 19, 2018
1 parent 9680822 commit ca2e951
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,57 +46,64 @@ throw new ApiError(400, error, optionalArgs);

### BadRequestError

extends from ApiError with a preset of status code 400.
extends from ApiError with a preset of status code 400 and BAD_REQUEST as error.

```javascript
throw new BadRequestError(); // or
throw new BadRequestError(error, optionalArgs);
```

### NotFoundError

extends from ApiError with a preset of status code 404.
extends from ApiError with a preset of status code 404 and RESOURCE_NOT_FOUND as error.

```javascript
throw new NotFoundError(); // or
throw new NotFoundError(error, optionalArgs);
```

### ForbiddenError

extends from ApiError with a preset of status code 403.
extends from ApiError with a preset of status code 403 and FORBIDDEN as error.

```javascript
throw new ForbiddenError(); // or
throw new ForbiddenError(error, optionalArgs);
```

### InternalServerError

extends from ApiError with a preset of status code 500.
extends from ApiError with a preset of status code 500 and INTERNAL_ERROR as error.

```javascript
throw new InternalServerError(); // or
throw new InternalServerError(error, optionalArgs);
```

### UnauthorizedError

extends from ApiError with a preset of status code 401.
extends from ApiError with a preset of status code 401 and UNAUTHORIZED as error.

```javascript
throw new UnauthorizedError(); // or
throw new UnauthorizedError(error, optionalArgs);
```

### ValidationError

extends from ApiError with a preset of status code 400.
extends from ApiError with a preset of status code 400 and INVALID_INPUT as error.

```javascript
throw new ValidationError(); // or
throw new ValidationError(error, optionalArgs);
```

### AuthenticationError

extends from ApiError with a preset of status code 400.
extends from ApiError with a preset of status code 400 and AUTHENTICATION_FAILED as error.

```javascript
throw new AuthenticationError(); // or
throw new AuthenticationError(error, optionalArgs);
```

Expand Down

0 comments on commit ca2e951

Please sign in to comment.