minor refactoring on final exception handling to response code