Implemented custom error response helper.