Class SentryException

java.lang.Object
io.sentry.protocol.SentryException
All Implemented Interfaces:
JsonSerializable, JsonUnknown

public final class SentryException extends Object implements JsonUnknown, JsonSerializable
A single exception.

Multiple values inside of an [event](#typedef-Event) represent chained exceptions and should be sorted oldest to newest. For example, consider this Python code snippet:

```python try: raise Exception("random boring invariant was not met!") except Exception as e: raise ValueError("something went wrong, help!") from e ```

`Exception` would be described first in the values list, followed by a description of `ValueError`:

```json { "exception": { "values": [ {"type": "Exception": "value": "random boring invariant was not met!"}, {"type": "ValueError", "value": "something went wrong, help!"}, ] } } ```

  • Constructor Details

    • SentryException

      public SentryException()
  • Method Details

    • getType

      @Nullable public @Nullable String getType()
      The Exception Type.
      Returns:
      the type of the exception.
    • setType

      public void setType(@Nullable @Nullable String type)
      The Exception Type.
      Parameters:
      type - type of the exception.
    • getValue

      @Nullable public @Nullable String getValue()
      The exception value.
      Returns:
      the value.
    • setValue

      public void setValue(@Nullable @Nullable String value)
      The exception value
      Parameters:
      value - The exception message
    • getModule

      @Nullable public @Nullable String getModule()
      Gets the optional module, or package which the exception type lives in.
      Returns:
      the module.
    • setModule

      public void setModule(@Nullable @Nullable String module)
      Sets the optional module, or package which the exception type lives in.
      Parameters:
      module - the module.
    • getThreadId

      @Nullable public @Nullable Long getThreadId()
      Gets an optional value which refers to a thread in the threads interface.
      Returns:
      the thread id.
    • setThreadId

      public void setThreadId(@Nullable @Nullable Long threadId)
      Sets an optional value which refers to a thread in the threads interface.
      Parameters:
      threadId - the thread id.
    • getStacktrace

      @Nullable public @Nullable SentryStackTrace getStacktrace()
      Gets the stack trace.
      Returns:
      the stacktrace.
    • setStacktrace

      public void setStacktrace(@Nullable @Nullable SentryStackTrace stacktrace)
      Sets the stack trace.
      Parameters:
      stacktrace - the stacktrace of the exception.
    • getMechanism

      @Nullable public @Nullable Mechanism getMechanism()
      Gets an optional mechanism that created this exception.
      Returns:
      the mechanism.
    • setMechanism

      public void setMechanism(@Nullable @Nullable Mechanism mechanism)
      Sets an optional mechanism that created this exception.
      Parameters:
      mechanism - the mechanism.
    • getUnknown

      @Nullable public @Nullable Map<String,Object> getUnknown()
      Specified by:
      getUnknown in interface JsonUnknown
    • setUnknown

      public void setUnknown(@Nullable @Nullable Map<String,Object> unknown)
      Specified by:
      setUnknown in interface JsonUnknown
    • serialize

      public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException
      Specified by:
      serialize in interface JsonSerializable
      Throws:
      IOException