Package: org.apache.groovy.json.internal

## [Java] Class Exceptions

- org.apache.groovy.json.internal.Exceptions

-     public class Exceptions
      extends Object

  Internal exception helpers used by the JSON parser implementation.

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `static class` | `Exceptions.JsonInternalException` | Runtime exception used inside the JSON internals to simplify propagation.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static boolean` | `die()` Throws a generic internal JSON exception.
    `` | `public static boolean` | `die(String message)` Throws an internal JSON exception with the supplied message.
    `<T>` | `public static T` | `die(Class<T> clazz, String message)` Throws an internal JSON exception with the supplied message.
    `` | `public static void` | `handle(Exception e)` Rethrows the supplied exception as an internal JSON exception.
    `<T>` | `public static T` | `handle(Class<T> clazz, Exception e)` Rethrows the supplied exception as an internal JSON exception.
    `<T>` | `public static T` | `handle(Class<T> clazz, String message, Throwable e)` Rethrows the supplied throwable as an internal JSON exception with a message.
    `` | `public static void` | `handle(String message, Throwable e)` Rethrows the supplied throwable as an internal JSON exception with a message.
    `` | `public static String` | `sputs(CharBuf buf, Object messages)` Appends messages to the supplied buffer and returns its current contents.
    `` | `public static String` | `sputs(Object messages)` Creates a temporary buffer, appends the supplied messages, and returns the result.
    `` | `public static String` | `toString(Exception ex)` Formats an exception and its stack trace for debug output.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public static boolean die()

      Throws a generic internal JSON exception.

      Returns:
        never returns normally

    - #### public static boolean die(String message)

      Throws an internal JSON exception with the supplied message.

      Parameters:
        `message` - the failure message
      Returns:
        never returns normally

    - #### <T> public static T die(Class<T> clazz, String message)

      Throws an internal JSON exception with the supplied message.

      Parameters:
        `clazz` - the ignored target type used for generic flow
        `message` - the failure message
      Type Parameters:
        `T` - the generic return type
      Returns:
        never returns normally

    - #### public static void handle(Exception e)

      Rethrows the supplied exception as an internal JSON exception.

      Parameters:
        `e` - the exception to wrap

    - #### <T> public static T handle(Class<T> clazz, Exception e)

      Rethrows the supplied exception as an internal JSON exception.

      Parameters:
        `clazz` - the ignored target type used for generic flow
        `e` - the exception to wrap
      Type Parameters:
        `T` - the generic return type
      Returns:
        never returns normally

    - #### <T> public static T handle(Class<T> clazz, String message, Throwable e)

      Rethrows the supplied throwable as an internal JSON exception with a message.

      Parameters:
        `clazz` - the ignored target type used for generic flow
        `message` - the failure message
        `e` - the throwable to wrap
      Type Parameters:
        `T` - the generic return type
      Returns:
        never returns normally

    - #### public static void handle(String message, Throwable e)

      Rethrows the supplied throwable as an internal JSON exception with a message.

      Parameters:
        `message` - the failure message
        `e` - the throwable to wrap

    - #### public static String sputs(CharBuf buf, Object messages)

      Appends messages to the supplied buffer and returns its current contents.

      Parameters:
        `buf` - the destination buffer
        `messages` - the messages to append
      Returns:
        the buffer content after appending the messages

    - #### public static String sputs(Object messages)

      Creates a temporary buffer, appends the supplied messages, and returns the result.

      Parameters:
        `messages` - the messages to append
      Returns:
        the formatted message text

    - #### public static String toString(Exception ex)

      Formats an exception and its stack trace for debug output.

      Parameters:
        `ex` - the exception to format
      Returns:
        the formatted exception text