TODO add exception wrapper
488028
public function handle(Request $request, $requestType = self::REQUEST_TYPE_MASTER)
  {
    // Boot on first request
    if (!$this->booted) $this->boot();
    
    try
    {
      return $this->handleRaw($request,$requestType);
    } 
    catch (\Exception $ex) // TODO: Implement Exception listener
    {
      $class = get_class($ex);
      $message = $ex->getMessage();
      switch($class)
      {
        case 'Symfony\Component\Security\Core\Exception\AccessDeniedException':
          $code = 401;
          break;
        default:
          $code = 401;
      }
      $response = new ResponseJson(['error' => $message],$code);
      
      // Need this so auth headers get set
      $dispatcher = $this->container->get('event_dispatcher');
      return $this->dispatchResponse($dispatcher,$request,$response);
    }
  }
884751
function exception(exceptionObj) {
  const errorMessage = getErrorMessage(exceptionObj);
  const errorDetails = getErrorDetails(exceptionObj);

  return {
    ok: false,
    error: errorMessage,
    details: errorDetails,
  };
}
831010
public static Throwable unwrap(Throwable t) {
        for (;;) {
            if (t == null)
                throw new NullPointerException();

            if (t instanceof java.util.concurrent.ExecutionException)
                t = t.getCause();
            else if (t instanceof java.lang.reflect.InvocationTargetException)
                t = t.getCause();
            else if (t.getClass().equals(RuntimeException.class) && t.getCause() != null)
                t = t.getCause();
            else
                return t;
        }
    }
1186729
private Exception generateException(int rc, String text,
                                        Exception linkedException, boolean throwIt)
                    throws SIResourceException, SIConnectionLostException,
                    SILimitExceededException, SIErrorException, SINotAuthorizedException,
                    SINotPossibleInCurrentConfigurationException,
                    SIIncorrectCallException, SIAuthenticationException {

        Exception theException;

        if (rc == TrmConstantsImpl.RETURN_CODE_SIResourceException) {
            SIResourceException sire = new SIResourceException(text);
            if (null != linkedException) {
                sire.initCause(linkedException);
            }
            if (throwIt) {
                throw sire;
            } else {
                theException = sire;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIConnectionLostException) {
            SIConnectionLostException sicle = new SIConnectionLostException(text);
            if (null != linkedException) {
                sicle.initCause(linkedException);
            }
            if (throwIt) {
                throw sicle;
            } else {
                theException = sicle;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SILimitExceededException) {
            SILimitExceededException silee = new SILimitExceededException(text);
            if (null != linkedException) {

            }
            if (throwIt) {
                throw silee;
            } else {
                theException = silee;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIErrorException) {
            SIErrorException siee = new SIErrorException(text);
            if (null != linkedException) {
                siee.initCause(linkedException);
            }
            if (throwIt) {
                throw siee;
            } else {
                theException = siee;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SINotAuthorizedException) {
            SINotAuthorizedException sinae = new SINotAuthorizedException(text);
            if (null != linkedException) {
                // This is not permitted!

            }
            if (throwIt) {
                throw sinae;
            } else {
                theException = sinae;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SINotPossibleInCurrentConfigurationException) {
            SINotPossibleInCurrentConfigurationException sinpicce = new SINotPossibleInCurrentConfigurationException(
                            text);
            if (null != linkedException) {
                sinpicce.initCause(linkedException);
            }
            if (throwIt) {
                throw sinpicce;
            } else {
                theException = sinpicce;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIIncorrectCallException) {
            SIIncorrectCallException siice = new SIIncorrectCallException(text);
            if (null != linkedException) {
                siice.initCause(linkedException);
            }
            if (throwIt) {
                throw siice;
            } else {
                theException = siice;
            }
        } else if (rc == TrmConstantsImpl.RETURN_CODE_SIAuthenticationException) {
            SIAuthenticationException siae = new SIAuthenticationException(text);
            if (null != linkedException) {
                // This is not permitted!
            }
            if (throwIt) {
                throw siae;
            } else {
                theException = siae;
            }
        } else {
            SIErrorException siee = new SIErrorException(text);
            if (null != linkedException) {
                siee.initCause(linkedException);
            }
            if (throwIt) {
                throw siee;
            } else {
                theException = siee;
            }
        }

        return theException;
    }
398214
def exception(self, *args, **kwargs):
        """"""
        kwargs['api'] = self.api
        return exception(*args, **kwargs)
751818
function exception(type) {
	
	var message = errors[type];
	
	for(var i = 1; i < arguments.length; i++)
		message = message.replace('%', arguments[i].toString().replace(/\((.|\r\n|\n|\r)*/gm, ''));
	
	return "Exception: " + message;
}
185246
public static void addThrowableAndCauses(List<ThrowableDTO> exceptions, Throwable exception) {
        if (exception != null) {
            ThrowableDTO dto = new ThrowableDTO(exception);
            exceptions.add(dto);
            Throwable cause = exception.getCause();
            if (cause != null && cause != exception) {
                addThrowableAndCauses(exceptions, cause);
            }
        }
    }
117785
protected RuntimeException runtimeException(final Exception exception) {
        if (exception instanceof RuntimeException) {
            throw (RuntimeException) exception;
        } else {
            throw new RuntimeException(exception);
        }
    }
971631
def exception(self):
        
        if self._jsq.exception().isDefined():
            je = self._jsq.exception().get()
            msg = je.toString().split(': ', 1)[1]  # Drop the Java StreamingQueryException type info
            stackTrace = '\n\t at '.join(map(lambda x: x.toString(), je.getStackTrace()))
            return StreamingQueryException(msg, stackTrace, je.getCause())
        else:
            return None
295907
private static void throwRuntimeException(String msg, InvocationTargetException e) {
    Throwable cause = e.getCause();
    if (cause != null) {
      throw new RuntimeException(msg + ": " + cause.getMessage(), cause);
    } else {
      throw new RuntimeException(msg + ": " + e.getMessage(), e);
    }
  }
779518
public static RuntimeException convertReflectionExceptionToUnchecked(Exception e) {
		if ((e instanceof IllegalAccessException) || (e instanceof NoSuchMethodException)) {
			return new IllegalArgumentException(e);
		} else if (e instanceof InvocationTargetException) {
			return new RuntimeException(((InvocationTargetException) e).getTargetException());
		} else if (e instanceof RuntimeException) {
			return (RuntimeException) e;
		}
		return new UncheckedException(e);
	}
134641
@Override
  public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) {
    Logger logger = Logger.getLogger(clazz.getName());
    logger.logp(convertToJDK14Level(logLevel), clazz.getName(), "-", throwable.getMessage(), throwable);
  }
581375
public <T extends Exception> Javalin exception(@NotNull Class<T> exceptionClass, @NotNull ExceptionHandler<? super T> exceptionHandler) {
        servlet.getExceptionMapper().getHandlers().put(exceptionClass, (ExceptionHandler<Exception>) exceptionHandler);
        return this;
    }
16663
public static SystemException unwrapSystemException(Throwable throwable) {
        if (throwable == null) {
            return null;
        } else if (throwable instanceof SystemException) {
            return (SystemException) throwable;
        } else if (throwable.getCause() != null) {
            // recursive call to unwrap the cause
            return unwrapSystemException(throwable.getCause());
        } else {
            // didn't find any SystemException in the cause stack
            return null;
        }
    }
792452
def exception(function):
    
    @functools.wraps(function)
    def wrapper(*exception, **kwargs):
        result = function(**kwargs)
        if exception:
            result.exception = exception[0]
        return result
    return wrapper
1240334
@SuppressLint({
      "LogNotTimber", //
      "StringFormatInTimber", //
      "ThrowableNotAtBeginning", //
      "BinaryOperationInTimber", //
      "TimberArgCount", //
      "TimberArgTypes", //
      "TimberTagLength", //
      "TimberExceptionLogging" //
  }) //
  @Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // LogNotTimber
    Log.d("TAG", "msg");
    Log.d("TAG", "msg", new Exception());
    android.util.Log.d("TAG", "msg");
    android.util.Log.d("TAG", "msg", new Exception());

    // StringFormatInTimber
    Timber.w(String.format("%s", getString()));
    Timber.w(format("%s", getString()));

    // ThrowableNotAtBeginning
    Timber.d("%s", new Exception());

    // BinaryOperationInTimber
    String foo = "foo";
    String bar = "bar";
    Timber.d("foo" + "bar");
    Timber.d("foo" + bar);
    Timber.d(foo + "bar");
    Timber.d(foo + bar);

    // TimberArgCount
    Timber.d("%s %s", "arg0");
    Timber.d("%s", "arg0", "arg1");
    Timber.tag("tag").d("%s %s", "arg0");
    Timber.tag("tag").d("%s", "arg0", "arg1");

    // TimberArgTypes
    Timber.d("%d", "arg0");
    Timber.tag("tag").d("%d", "arg0");

    // TimberTagLength
    Timber.tag("abcdefghijklmnopqrstuvwx");
    Timber.tag("abcdefghijklmnopqrstuvw" + "x");

    // TimberExceptionLogging
    Timber.d(new Exception(), new Exception().getMessage());
    Timber.d(new Exception(), "");
    Timber.d(new Exception(), null);
    Timber.d(new Exception().getMessage());
  }
432110
public static RuntimeException asRuntime(Throwable e) {
		if (e instanceof RuntimeException) {
			return (RuntimeException) e;
		} else {
			return new WrappedAsRuntimeException(e);
		}
	}