Return specific status codes depending on the exception