Similar to result(), except returns the exception if any.
979831
def exception(self, timeout=None):
        """"""
        # Check exceptional case: return none if no error
        if not self._poll(timeout).HasField('error'):
            return None

        # Return expected error
        return self._operation.error
1271981
@CheckReturnValue
    public Maybe<E> maybe() {
        return Maybe.fromCallable(new Callable<E>() {
            @Override
            public E call() throws Exception {
                return firstOrNull();
            }
        });
    }
229744
public boolean isFailure(R result, Throwable failure) {
    for (BiPredicate<R, Throwable> predicate : failureConditions) {
      try {
        if (predicate.test(result, failure))
          return true;
      } catch (Exception ignored) {
        // Ignore confused user-supplied predicates.
        // They should not be allowed to halt execution of the operation.
      }
    }

    // Fail by default if a failure is not checked by a condition
    return failure != null && !failuresChecked;
  }
522158
@Override
    public Result onError(Context context, String reason) {
        return Results.forbidden(reason);
    }
737653
def exception(cls, method, uri, response, message):
        
        # noinspection PyBroadException
        try:
            error_payload = json.loads(response.text)
            if 'message' in error_payload:
                message = '{}: {}'.format(message, error_payload['message'])
            code = error_payload.get('code', response.status_code)
            return TwilioRestException(response.status_code, uri, message, code, method)
        except Exception:
            return TwilioRestException(response.status_code, uri, message, response.status_code, method)
366260
public <E extends Exception> boolean anyMatch(Try.BooleanPredicate<E> filter) throws E {
        return anyMatch(0, size(), filter);
    }
161797
public static final RuntimeException convertException(Exception ex) {
        if (ex instanceof RuntimeException) {
            return (RuntimeException) ex;
        }
        return new ExceptionConverter(ex);
    }
406939
def get(self, timeout=None):
        # type: (float) -> T
        """"""
        self.wait(timeout)
        if isinstance(self._result, Exception):
            raise self._result
        return self._result
72041
def trap_exceptions(results, handler, exceptions=Exception):
	
	try:
		for result in results:
			yield result
	except exceptions as exc:
		for result in always_iterable(handler(exc)):
			yield result
66334
private int getMatchedDepth(String exceptionType, Throwable ex) {
        Throwable t = ex.getCause();
        if (t != null) {
            return getMatchedDepth(exceptionType, t);
        } else {
            return getMatchedDepth(exceptionType, ex.getClass(), 0);
        }
    }
690418
def exception(self, url, exception):
        ''''''
        return (time.time() + self.ttl, self.factory(url))
899137
def except_handle(tokens):
    """"""
    if len(tokens) == 1:
        errs, asname = tokens[0], None
    elif len(tokens) == 2:
        errs, asname = tokens
    else:
        raise CoconutInternalException("invalid except tokens", tokens)
    out = "except "
    if "list" in tokens:
        out += "(" + errs + ")"
    else:
        out += errs
    if asname is not None:
        out += " as " + asname
    return out
614519
def __request_except(self, requestId, exc, set_and_forget=True):
        """"""
        try:
            with self.__requests:
                if set_and_forget:
                    req = self.__requests.pop(requestId)
                else:
                    req = self.__requests[requestId]
        except KeyError:
            logger.error('Unknown request %s - cannot set exception', requestId)
        else:
            if exc is not None:
                req.exception = exc
            if set_and_forget:
                req._set()
586170
public Api getQueryResult(String query) throws Exception {
    Api result = this.getActionResult("query", query, null, null);
    return result;
  }
482417
def _catch(f, exception_type):
  """"""
  if not (inspect.isclass(exception_type)
          and issubclass(exception_type, Exception)):
    exception_type = Exception

  @functools.wraps(f)
  def wrap(*args, **kw):
    try:
      return f(*args, **kw)
    except exception_type as e:  # pylint: disable=broad-except
      qj(e, 'Caught an exception in %s' % f, d=1, _depth=2)
  return wrap
536451
public <E extends Exception> boolean noneMatch(Try.FloatPredicate<E> filter) throws E {
        return noneMatch(0, size(), filter);
    }
944296
public <E extends Exception> boolean noneMatch(Try.LongPredicate<E> filter) throws E {
        return noneMatch(0, size(), filter);
    }