WLJS LogoWLJS Notebook

ThrowException

ThrowException[spec]
ThrowException[spec, payload]

creates and throws an Exception object. Use it inside code whose caller handles structured errors with CatchExceptions.

Example

CatchExceptions[
  ThrowException["DataConsistencyError", <|"Data" -> 42|>],
  All
]

Calling ThrowException without an enclosing handler produces an uncaught-exception message.

See the official Wolfram Language reference for accepted exception specifications.

On this page