WIP Feat/error handling

Adds support for injecting CORS headers even in the case of internal server errors.

Note: in debug mode, the exception is returned to users, and CORS headers are not applied. (Potential TODO)