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

[Merged by Bors] - feat: adding serialized check (CV3-289) #461

Closed
wants to merge 5 commits into from

Conversation

zhihil
Copy link
Contributor

@zhihil zhihil commented Oct 11, 2023

Fixes or implements CV3-289

Brief description. What is this change?

Adding a new static method to HTTPException to check if a plain object is an instance of a serialized HTTPException.

The reason this method should be added as part of the HTTPException API is because the HTTPException is often serialized and transmitted over the wire to a different service. The client service which receives the serialized HTTPException needs a method to detect that the error payload is of shape SerializedHTTPException and not something else like a basic JavaScript Error. This is a very common use-case.

Without this method, every client has to implement the duck-typing check for SerializedHTTPException to proper handle this exception. This creates duplication.

Implementation details. How do you make this change?

Setup information

Deployment Notes

Related PRs

Checklist

  • Breaking changes have been communicated, including:
    • New required environment variables
    • Renaming of interfaces (API routes, request/response interface, etc)
  • New environment variables have been deployed
  • Appropriate tests have been written
    • Bug fixes are accompanied by an updated or new test
    • New features are accompanied by a new test

@zhihil zhihil self-assigned this Oct 11, 2023
Copy link

@pmvrmc pmvrmc left a comment

Choose a reason for hiding this comment

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

approved with some comments

packages/exception/src/http/http.exception.ts Outdated Show resolved Hide resolved
packages/exception/src/http/http.exception.ts Outdated Show resolved Hide resolved
@zhihil zhihil force-pushed the brennan/change-reset-password-error/CV3-289 branch from a503794 to 18c4366 Compare October 12, 2023 16:49
@zhihil
Copy link
Contributor Author

zhihil commented Oct 12, 2023

bors r+

bors-vf bot pushed a commit that referenced this pull request Oct 12, 2023
<!-- You can erase any parts of this template not applicable to your Pull Request. -->

**Fixes or implements CV3-289**

### Brief description. What is this change?

<!-- Build up some context for your teammates on the changes made here and potential tradeoffs made and/or highlight any topics for discussion -->

Adding a new static method to `HTTPException` to check if a plain object is an instance of a serialized `HTTPException`.

The reason this method should be added as part of the `HTTPException` API is because the `HTTPException` is often serialized and transmitted over the wire to a different service. The client service which receives the serialized `HTTPException` needs a method to detect that the error payload is of shape `SerializedHTTPException` and not something else like a basic JavaScript `Error`. This is a very common use-case. 

Without this method, every client has to implement the duck-typing check for `SerializedHTTPException` to proper handle this exception. This creates duplication.
@bors-vf
Copy link

bors-vf bot commented Oct 12, 2023

Timed out.

@sonarcloud
Copy link

sonarcloud bot commented Oct 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

warning The version of Java (11.0.3) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

@zhihil
Copy link
Contributor Author

zhihil commented Oct 12, 2023

bors r+

bors-vf bot pushed a commit that referenced this pull request Oct 12, 2023
<!-- You can erase any parts of this template not applicable to your Pull Request. -->

**Fixes or implements CV3-289**

### Brief description. What is this change?

<!-- Build up some context for your teammates on the changes made here and potential tradeoffs made and/or highlight any topics for discussion -->

Adding a new static method to `HTTPException` to check if a plain object is an instance of a serialized `HTTPException`.

The reason this method should be added as part of the `HTTPException` API is because the `HTTPException` is often serialized and transmitted over the wire to a different service. The client service which receives the serialized `HTTPException` needs a method to detect that the error payload is of shape `SerializedHTTPException` and not something else like a basic JavaScript `Error`. This is a very common use-case. 

Without this method, every client has to implement the duck-typing check for `SerializedHTTPException` to proper handle this exception. This creates duplication.
@bors-vf
Copy link

bors-vf bot commented Oct 12, 2023

Pull request successfully merged into master.

Build succeeded:

@bors-vf bors-vf bot changed the title feat: adding serialized check (CV3-289) [Merged by Bors] - feat: adding serialized check (CV3-289) Oct 12, 2023
@bors-vf bors-vf bot closed this Oct 12, 2023
@bors-vf bors-vf bot deleted the brennan/change-reset-password-error/CV3-289 branch October 12, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants