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

Change relay-related errors to throw client-side errors #1281

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Mar 11, 2024

Summary

This changes the relay-specific errors from extending Errors to HttpException/UnprocessableEntityExceptions in order to specify a status. By specifying the status, the RouteLoggerInteceptor can extract it.

Changes

The following exceptions have been changed to extend HttpExceptions with a HttpStatus or UnprocessableEntityException accordingly:

  • InvalidMultiSendError
  • InvalidTransferError
  • RelayLimitReachedError
  • UnofficialMasterCopyError
  • UnofficialMultiSendError
  • UnofficialProxyFactoryError

@iamacook iamacook self-assigned this Mar 11, 2024
@iamacook iamacook requested a review from a team as a code owner March 11, 2024 15:53
export class InvalidMultiSendError extends Error {
import { HttpException, HttpStatus } from '@nestjs/common';

export class InvalidMultiSendError extends HttpException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the status is known, maybe we can extend UnprocessableEntityException. No strong opinion here though.

(same for the others but with their respective exceptions classes).

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't aware of that! I changed it in 6e5c04c. There doesn't seem to be one for 429 though.

@coveralls
Copy link

coveralls commented Mar 11, 2024

Pull Request Test Coverage Report for Build 8236133889

Details

  • 12 of 12 (100.0%) changed or added relevant lines in 6 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 93.437%

Files with Coverage Reduction New Missed Lines %
src/routes/transactions/entities/tests/human-description.builder.ts 1 90.0%
Totals Coverage Status
Change from base Build 8231720309: 0.004%
Covered Lines: 6399
Relevant Lines: 6615

💛 - Coveralls

@iamacook iamacook requested a review from fmrsabino March 11, 2024 16:14
Copy link
Contributor

@fmrsabino fmrsabino left a comment

Choose a reason for hiding this comment

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

🚀

@iamacook iamacook merged commit e9e0be3 into main Mar 12, 2024
16 checks passed
@iamacook iamacook deleted the relay-route-logging branch March 12, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants