SSW.Rewards.Mobile icon indicating copy to clipboard operation
SSW.Rewards.Mobile copied to clipboard

Refactor Api - Review exceptions

Open JackDevAU opened this issue 3 years ago • 0 comments

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

JackDevAU avatar Jun 14 '22 00:06 JackDevAU