Change code style to improve error reporting so failures show what actually broke

Github

Github
API
Adds a shared way for the API to report errors, so an unexpected failure now reaches Sentry with the real error instead of a generic Internal Server Error. That means faster diagnosis when something goes wrong for a customer, and much less noise from everyday things like a page that was not found.