At the moment unexpected exceptions occurring in the REST route handlers get caught by UnexpectedErrorHandler and do not get logged anywhere, which makes it hard to figure out the cause of an error during development.
This ticket only covers the requirements of the developers of the REST API. A story ticket with the requirements of other teams (Wikidata, Wikibase Cloud, ...) running a Wikibase with the REST API will follow.