We handle errors using thiserror and eyre, but neither allow us to attach an HTTP status code to the error. We could use a procedual macro (e.g. bitcoinsuite-error-derive), however, this has many downsides.
Instead, we opt for a much simpler approach: Simply encode the HTTP status in the error message as a prefix. This way a DB failure can be prefixed with e.g. "500: ", and when a queried tx is not found in the chain, we can prefix the error with "404: ".