On exception return the correct status code