Skip to content

Conversation

@flopez7
Copy link
Contributor

@flopez7 flopez7 commented May 12, 2025

Issue tracking

N/A

Context behind the change

Refactor error handling across services to use custom error classes:

  • Replaced instances of ControlledError with specific error classes (ValidationError, NotFoundError, ConflictError, ServerError) in QualificationService, RateService, RoutingProtocolService, SendGridService, StorageService, Web3Service, WebhookService, and their respective test files.
  • Removed the storage.errors.ts file as its functionality is now integrated into the common error handling.
  • Updated tests to reflect changes in error handling and ensure proper error types are thrown and caught.

How has this been tested?

  • Deployed locally and called some endpoints to see if custom errors were thrown.
  • Ran unit tests

Release plan

None

Potential risks; What to monitor; Rollback plan

Check that the new errors are not instance of ControlledError

- Replaced instances of ControlledError with specific error classes (ValidationError, NotFoundError, ConflictError, ServerError) in QualificationService, RateService, RoutingProtocolService, SendGridService, StorageService, Web3Service, WebhookService, and their respective test files.
- Removed the storage.errors.ts file as its functionality is now integrated into the common error handling.
- Updated tests to reflect changes in error handling and ensure proper error types are thrown and caught.
@vercel
Copy link

vercel bot commented May 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
faucet-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 8:17am
faucet-server ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 8:17am
human-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 8:17am
human-dashboard-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 8:17am
staking-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 8:17am

Copy link
Collaborator

@dnechay dnechay left a comment

Choose a reason for hiding this comment

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

Looks cleaner! Left some questions and suggestions

  • in all places that are not directly used by http layer (e.g. common/utils or storage.service) we probably should not use HTTP-related Errors, it's a bit confusing to see things like ConflictError when you validate web3 signature and not intuitive for developer from the future on how to pick some specific error class from all of these
  • I noticed that you changed "http-response code" for some cases (e.g. in job.service some places have 409/422 vs 400 before), can it affect something on UI?

@flopez7 flopez7 requested a review from dnechay May 13, 2025 14:02
dnechay
dnechay previously approved these changes May 13, 2025
@dnechay
Copy link
Collaborator

dnechay commented May 13, 2025

Please double-check that client-facing (I mean FE app) functionality is not broken in places where status codes changed

Copy link
Collaborator

@dnechay dnechay left a comment

Choose a reason for hiding this comment

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

lgtm

Let's wait for @portuu3 and released yarn upgrade

@flopez7 flopez7 merged commit 58f4dab into develop May 14, 2025
24 checks passed
@flopez7 flopez7 deleted the feat/job-launcher/error-handling branch May 14, 2025 09:20
@flopez7 flopez7 mentioned this pull request May 14, 2025
10 tasks
flopez7 added a commit that referenced this pull request May 21, 2025
* Refactor error handling across services to use custom error classes

- Replaced instances of ControlledError with specific error classes (ValidationError, NotFoundError, ConflictError, ServerError) in QualificationService, RateService, RoutingProtocolService, SendGridService, StorageService, Web3Service, WebhookService, and their respective test files.
- Removed the storage.errors.ts file as its functionality is now integrated into the common error handling.
- Updated tests to reflect changes in error handling and ensure proper error types are thrown and caught.

* feat: enhance error handling and validation across services

* feat: add logging for missing user object in WhitelistAuthGuard

* fix: update error handling for card deletion and signature verification
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