-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve forbidden error handling #1104
Conversation
@@ -15,3 +15,7 @@ export class AuthenticationError extends Error { | |||
this.stack = e.stack; | |||
} | |||
} | |||
|
|||
export class ForbiddenError extends Error { | |||
public readonly code: number = 403; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code does not seem to be used anywhere in the code. Are you sure you need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really no
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm removing it
@@ -52,6 +53,10 @@ export default class ServerUtils { | |||
throw new Error('Failed to reach Forest Admin server. Are you online?'); | |||
} | |||
|
|||
if (status === 403) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuthenticationError
can be throw at this step, to centralise the error management :/ ?
Code Climate has analyzed commit 702b8bc and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (98% is the threshold). This pull request will bring the total coverage in the repository to 97.5%. View more on Code Climate. |
## [1.8.9](https://github.com/ForestAdmin/agent-nodejs/compare/example@1.8.8...example@1.8.9) (2024-04-11) ### Features * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
# [1.39.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/agent@1.38.12...@forestadmin/agent@1.39.0) (2024-04-11) ### Features * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
🎉 This PR is included in version 1.8.3 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
# [1.27.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/forestadmin-client@1.26.2...@forestadmin/forestadmin-client@1.27.0) (2024-04-11) ### Features * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
🎉 This PR is included in version 1.8.9 🎉 The release is available on Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.39.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.27.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
## [1.44.3](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-customizer@1.44.2...@forestadmin/datasource-customizer@1.44.3) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
## [1.1.13](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-dummy@1.1.12...@forestadmin/datasource-dummy@1.1.13) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
# [1.3.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-mongo@1.2.1...@forestadmin/datasource-mongo@1.3.0) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
🎉 This PR is included in version 1.3.8 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
## [1.7.2](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-mongoose@1.7.1...@forestadmin/datasource-mongoose@1.7.2) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
## [1.8.2](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-sequelize@1.8.1...@forestadmin/datasource-sequelize@1.8.2) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
# [1.14.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-sql@1.13.1...@forestadmin/datasource-sql@1.14.0) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
# [1.33.0](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/datasource-toolkit@1.32.3...@forestadmin/datasource-toolkit@1.33.0) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
## [1.3.72](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/plugin-aws-s3@1.3.71...@forestadmin/plugin-aws-s3@1.3.72) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
## [1.0.84](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/plugin-export-advanced@1.0.83...@forestadmin/plugin-export-advanced@1.0.84) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
🎉 This PR is included in version 1.44.3 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
## [1.1.4](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/plugin-flattener@1.1.3...@forestadmin/plugin-flattener@1.1.4) (2024-04-12) ### Bug Fixes * spacing in error message ([#1102](#1102)) ([d094821](d094821)) ### Features * **datasource-mongo:** add support for ssh tunnelling ([#1103](#1103)) ([d518e65](d518e65)) * improve forbidden error handling ([#1104](#1104)) ([6e5cf71](6e5cf71))
🎉 This PR is included in version 1.1.13 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.3.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.7.2 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.8.2 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.14.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.33.0 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.3.72 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.0.84 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.1.4 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Definition of Done
#86by9khgr
General
Security