ErrorResponse class created, error handling more abstracted