source-academy / stories-backend

Backend of Source Academy extension for Stories support.
0 stars 0 forks source link

Add basic error handling framework and 404 handling #50

Closed RichDom2185 closed 1 year ago

RichDom2185 commented 1 year ago

Part of #49.

Only updated one controller as a minimal example. Remaining controllers will be updated in a future PR


Overview

There are 2 kinds of errors:

We use a custom error interface ClientError for our errors that have a custom status code. This allows us to create custom error messages, such as those in HandleDBError.


Screenshots

Previously, reading an invalid user gives the wrong status code and output:

image

Now, reading an invalid user will give the correct result:

image
github-actions[bot] commented 1 year ago

Coverage Status

coverage: 60.976% (-3.5%) from 64.516% when pulling 1291080eec6338185752fa4c8eea16c00af52648 on add-basic-404-handling into 5bd4e88efd0c4a8b52fc897cda14cd7d18470b69 on main.