ProblemException
A Problem that can be thrown.
Domain code can raise a problem document without depending on a web framework. This type lives in problem-details-core, and problem-details-ktor answers a thrown one with the document it carries. Build one from a declared problem type with exception, or wrap a document directly.
Carries a Problem instead of being one. Making Problem an interface would let this implement it, at the cost of the model's value semantics (copy, equals, destructuring) and of the single concrete type both codecs serialize. Nothing in the library substitutes an exception where a document is expected, so that trade buys nothing.
This class is final. ProblemType already declares a problem type once, and a subclass would restate its typeUri, title and status alongside it. Catch this type and switch on Problem.type instead of defining an exception class per problem type.
Reach for this when the document gets assembled at the throw site, from data only that site has. To turn an existing exception type into a problem, map it in the problem-details-ktor catalog. That leaves the exception itself free of any dependency on this library.
Parameters
the underlying failure, if any. Chained through Throwable.cause, and logged server-side when problem-details-ktor answers the exception, since it would otherwise be dropped without a trace.