Unleash is an API and it would simplyfy a lot of the specific errors could carry the expected HTTP status code for this error. This would eliminate the need for a gigantic switch/case in the handle-errors function.