Package io.sentry.protocol
Class SentryException
java.lang.Object
io.sentry.protocol.SentryException
- All Implemented Interfaces:
JsonSerializable
,JsonUnknown
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!"}, ] } } ```
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Mechanism
Gets an optional mechanism that created this exception.@Nullable String
Gets the optional module, or package which the exception type lives in.@Nullable SentryStackTrace
Gets the stack trace.@Nullable Long
Gets an optional value which refers to a thread in the threads interface.@Nullable String
getType()
The Exception Type.@Nullable String
getValue()
The exception value.void
serialize
(@NotNull ObjectWriter writer, @NotNull ILogger logger) void
setMechanism
(@Nullable Mechanism mechanism) Sets an optional mechanism that created this exception.void
Sets the optional module, or package which the exception type lives in.void
setStacktrace
(@Nullable SentryStackTrace stacktrace) Sets the stack trace.void
setThreadId
(@Nullable Long threadId) Sets an optional value which refers to a thread in the threads interface.void
The Exception Type.void
setUnknown
(@Nullable Map<String, Object> unknown) void
The exception value
-
Constructor Details
-
SentryException
public SentryException()
-
-
Method Details
-
getType
The Exception Type.- Returns:
- the type of the exception.
-
setType
The Exception Type.- Parameters:
type
- type of the exception.
-
getValue
The exception value.- Returns:
- the value.
-
setValue
The exception value- Parameters:
value
- The exception message
-
getModule
Gets the optional module, or package which the exception type lives in.- Returns:
- the module.
-
setModule
Sets the optional module, or package which the exception type lives in.- Parameters:
module
- the module.
-
getThreadId
Gets an optional value which refers to a thread in the threads interface.- Returns:
- the thread id.
-
setThreadId
Sets an optional value which refers to a thread in the threads interface.- Parameters:
threadId
- the thread id.
-
getStacktrace
Gets the stack trace.- Returns:
- the stacktrace.
-
setStacktrace
Sets the stack trace.- Parameters:
stacktrace
- the stacktrace of the exception.
-
getMechanism
Gets an optional mechanism that created this exception.- Returns:
- the mechanism.
-
setMechanism
Sets an optional mechanism that created this exception.- Parameters:
mechanism
- the mechanism.
-
getUnknown
- Specified by:
getUnknown
in interfaceJsonUnknown
-
setUnknown
- Specified by:
setUnknown
in interfaceJsonUnknown
-
serialize
public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException - Specified by:
serialize
in interfaceJsonSerializable
- Throws:
IOException
-