SSWConsulting / SSWConsulting/SSW.Rewards.Mobile

Refactor Api - Review exceptions

Open
#265 0 comments 0 reactions 2 assignees View on GitHub

@matt-goldman is already working on this.

Since Feb 26, 2024.

api ready tech debt
Dominant language
C#
Stars
37
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Exceptions are slow, we should move away from throwing exceptions inside routes and correctly set status codes instead of the blanket 500.

... exceptions should be used for truly exceptional circumstances.

  • Matt G

See:
https://www.ssw.com.au/rules/do-you-know-that-you-should-never-throw-an-exception-using-system-exception/
https://www.ssw.com.au/rules/do-you-catch-exceptions-precisely/
https://www.ssw.com.au/rules/do-you-return-the-correct-response-code/
https://www.ssw.com.au/rules/do-you-return-detailed-error-messages/
https://www.ssw.com.au/rules/use-fluent-validation/

  • Ctrl+Shift+F 'throw new'
  • Ensure it is appropriate to throw an exception
  • Ensure exception is handled by the ApiExceptionFilter

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.