Skip to content
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

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

realSpok
Copy link
Contributor

Definition of Done

#86by9khgr

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

@forest-bot
Copy link
Member

@realSpok realSpok changed the title feat: do not throw 500 on forbidden feat: improve forbidden error handling Apr 11, 2024
@@ -15,3 +15,7 @@ export class AuthenticationError extends Error {
this.stack = e.stack;
}
}

export class ForbiddenError extends Error {
public readonly code: number = 403;
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really no

Copy link
Contributor Author

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) {
Copy link
Member

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 :/ ?

Copy link

codeclimate bot commented Apr 11, 2024

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.

@realSpok realSpok merged commit 6e5cf71 into main Apr 11, 2024
22 checks passed
@realSpok realSpok deleted the feat/do-not-throw-500-on-forbidden branch April 11, 2024 14:18
forest-bot added a commit that referenced this pull request Apr 11, 2024
forest-bot added a commit that referenced this pull request Apr 11, 2024
@forest-bot
Copy link
Member

🎉 This PR is included in version 1.8.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.8.9 🎉

The release is available on example@1.8.9

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.39.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.27.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
# [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))
@forest-bot
Copy link
Member

🎉 This PR is included in version 1.3.8 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
# [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
# [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
@forest-bot
Copy link
Member

🎉 This PR is included in version 1.44.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

forest-bot added a commit that referenced this pull request Apr 12, 2024
## [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))
@forest-bot
Copy link
Member

🎉 This PR is included in version 1.1.13 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.3.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.7.2 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.8.2 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.14.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.33.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.3.72 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.0.84 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@forest-bot
Copy link
Member

🎉 This PR is included in version 1.1.4 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants