Skip to content

Commit

Permalink
style: Format code with rubocop, prettier, standardrb and standardjs
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsource-autofix[bot] authored Jul 13, 2023
1 parent af4740c commit b94daa2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ We have a method [paginated_collection()](../app/controllers/api/v1/base_control

## Error Codes

The method [handle\_api_error](../app/controllers/api/v1/base_controller.rb) takes care of rendering the error responses.
The method [handle_api_error](../app/controllers/api/v1/base_controller.rb) takes care of rendering the error responses.

1. Unauthorized - Happens when API key/token is invalid or if the user is not authorized(pundit) to access the endpoint.
2. Forbidden - This error will not be thrown for the most part. It is only thrown if there is no record to check for authorization(pundit).
3. Unprocessable Entity - This error is thrown if an unconfirmed user tries to sign in or if an API call to update a user record fails. A detailed message with the error is also provided.
4. Internal Server Error - This type of error is due to some method breaking and is not desired. It should be handled gracefully if observed.

The methods for rendering the above errors can be found in the [BaseController](../app/controllers/api/v1/base_controller.rb). They can be passed a message to be rendered along with the error response.
The methods for rendering the above errors can be found in the [BaseController](../app/controllers/api/v1/base_controller.rb). They can be passed a message to be rendered along with the error response.

0 comments on commit b94daa2

Please sign in to comment.