unless ($res->is_success) { # handle error here! }