# throwing

abstract fun throwing(exception: Throwable, problemId: ProblemId, spec: Action<in ProblemSpec>): RuntimeException

Configures a new problem, reports it, and uses it to throw a new exception.

An exception must be provided in the spec.

The spec must specify the exception, the problem label, and the category. Any additional configuration is optional.

#### Return

never returns by throwing the exception, but using `throw` statement at the call site is encouraged to indicate the intent and benefit from local control flow.

#### Since

8.13

#### Parameters

exception

the exception to throw after reporting the problems

problemId

the problem id

spec

the problem configuration

abstract fun throwing(exception: Throwable, problem: Problem): RuntimeException

Configures a new problem, reports it, and uses it to throw a new exception.

An exception must be provided in the spec.

The spec must specify the exception, the problem label, and the category. Any additional configuration is optional.

#### Return

never returns by throwing the exception, but using `throw` statement at the call site is encouraged to indicate the intent and benefit from local control flow.

#### Since

8.13

#### Parameters

exception

the exception to throw after reporting the problems

problem

the problem to report

abstract fun throwing(exception: Throwable, problems: Collection<out Problem>): RuntimeException

Reports the target problems and throws a runtime exception. When this method is used, all reported problems will be associated with the thrown exception.

#### Return

nothing, the method throws an exception

#### Since

8.13

#### Parameters

exception

the exception to throw after reporting the problems

problems

the problems to report