Skip to main content

Throwable Usage

By default, smithy4s generates error data types that extend java.lang.Throwable , For example the following spec:

@error("client")
structure BadRequest {
@required
reason: String
}

will generate following scala type:

case class BadRequest(reason: String) extends Throwable

It is however possible to annotate the error definition with the smithy4s.meta#noStackTrace trait

@error("client")
@noStackTrace
structure BadRequest {
@required
reason: String
}

This will result in generated type extending scala.util.control.NoStackTrace

case class BadRequest(reason: String) extends scala.util.control.NoStackTrace