Specifies that no exception of the given type should be
thrown, failing with a {@link UnallowedExceptionThrownError} otherwise.

@param type the exception type that should not be thrown
433532
public void notThrown(Class<? extends Throwable> type) {
    Throwable thrown = getSpecificationContext().getThrownException();
    if (thrown == null) return;
    if (type.isAssignableFrom(thrown.getClass())) {
      throw new UnallowedExceptionThrownError(type, thrown);
    }
    ExceptionUtil.sneakyThrow(thrown);
  }
446156
private void checkRunnable(Class<?> type) {
    if(Runnable.class.isAssignableFrom(type)) {
      try{
        this.method = type.getMethod("run");
      } catch(Exception e) {
        throw new RuntimeException("Cannot get run method of runnable class.", e);
      }
    }
  }
484518
public function throwException($message = '', $type = 'default')
    {
        switch ($type) {
            case 'access-denied':
                throw new AccessDeniedException($message);
            case 'not-found':
                throw new NotFoundHttpException($message);
            case 'runtime':
                throw new \RuntimeException($message);
            default:
                throw new \Exception($message);
        }
    }
941647
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setType(final String type) {
        pathBuilder.setType(type);
        return (T) this;
    }
434066
def handle_unhandled_exception(exc_type, exc_value, exc_traceback):
    """"""
    if issubclass(exc_type, KeyboardInterrupt):
        # call the default excepthook saved at __excepthook__
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return
    logger = logging.getLogger(__name__) # type: ignore
    logger.critical("Unhandled exception", exc_info=(exc_type, exc_value, exc_traceback))
139755
public static boolean isCheckedExceptionType(Type t, VisitorState state) {
    Symtab symtab = state.getSymtab();
    return isSubtype(t, symtab.exceptionType, state)
        && !isSubtype(t, symtab.runtimeExceptionType, state);
  }
1090948
@Override
	public void onUncaughtException(Throwable throwable) {
		for (ErrorHandler handler : this.errorHandlers) {
			if (handler.handle(throwable)) {
				return;
			}
		}
		this.defaultHandler.handle(throwable);
	}
1266392
public static void assertNoCheckedExceptionsAreThrown(final Method method, Class<? extends Annotation> annotation) 
   {
      Class<?>[] declaredExceptions = method.getExceptionTypes();
      for (int i = 0; i < declaredExceptions.length; i++)
      {
         Class<?> exception = declaredExceptions[i];
         if (!exception.isAssignableFrom(RuntimeException.class))
         {
            throw annotation == null ? MESSAGES.methodCannotThrowCheckedException(method) : MESSAGES.methodCannotThrowCheckedException2(method, annotation);
         }
      }
   }
876907
@SuppressWarnings("unused")
    private // until I can get this to work
    <T extends Throwable> void rethrowCauseOfType(Class<T> type)
        throws Throwable // this should be throws T
    {
        T cause = causeOfType(type);

        // rethrow acts as if its always throwing Throwable, not the subclass.
        if (cause != null) throw cause;
    }
1244747
public void addException(ClassConstant type, int start, int end, int handler)
  {
    _exceptions.add(new ExceptionItem(type.getIndex(), start, end, handler));
  }
633950
public static <T extends Throwable> T findException(Class<T> exceptionTypeToFind, Throwable t) {

    Throwable cause = t;

    while (cause != null)
    {
      if( exceptionTypeToFind.isAssignableFrom( cause.getClass() ) )
      {
        //noinspection unchecked
        return (T)cause;
      }
      if( cause == cause.getCause() )
      {
        return null;
      }
      cause = cause.getCause();
    }

    return null;
  }
294048
public static StoreException create(final Type type, final Throwable cause) {
        Preconditions.checkNotNull(cause, "cause");
        return create(type, cause, null);
    }
1067083
@SuppressWarnings("unchecked")
    public <T extends XPathBuilder> T setType(final String type) {
        this.type = type;
        return (T) this;
    }
380955
def setThrowException(self, setting):
        
        if setting:
            self._throwException = True
            self._findFailedResponse = "ABORT"
        else:
            self._throwException = False
            self._findFailedResponse = "SKIP"
59741
@Override
  public boolean accept(Class<?> type) {

    if (type != null) {
      if (this.forceInheritence) {
        Annotation annotation = this.annotationUtil.getTypeAnnotation(type, this.annotationType);
        return (annotation != null);
      } else {
        return type.isAnnotationPresent(this.annotationType);
      }

    }
    return false;
  }
356154
public static <T, X extends RuntimeException> T ifNonNullThrowOrElse(Supplier<X> exceptionSupplier,
            Supplier<T> provider) {
        if (Objects.nonNull(exceptionSupplier)) {
            throw exceptionSupplier.get();
        } else {
            return provider.get();
        }
    }
264344
public void setType(DBFDataType type) {
		if (!type.isWriteSupported()) {
			throw new IllegalArgumentException("No support for writting " + type);
		}
		this.type = type;
		if (type.getDefaultSize() > 0) {
			this.length = type.getDefaultSize();
		}

	}