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
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable MechanismGets an optional mechanism that created this exception.@Nullable StringGets the optional module, or package which the exception type lives in.@Nullable SentryStackTraceGets the stack trace.@Nullable LongGets an optional value which refers to a thread in the threads interface.@Nullable StringgetType()The Exception Type.@Nullable StringgetValue()The exception value.voidserialize(@NotNull ObjectWriter writer, @NotNull ILogger logger) voidsetMechanism(@Nullable Mechanism mechanism) Sets an optional mechanism that created this exception.voidSets the optional module, or package which the exception type lives in.voidsetStacktrace(@Nullable SentryStackTrace stacktrace) Sets the stack trace.voidsetThreadId(@Nullable Long threadId) Sets an optional value which refers to a thread in the threads interface.voidThe Exception Type.voidsetUnknown(@Nullable Map<String, Object> unknown) voidThe 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:
getUnknownin interfaceJsonUnknown
-
setUnknown
- Specified by:
setUnknownin interfaceJsonUnknown
-
serialize
public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException - Specified by:
serializein interfaceJsonSerializable- Throws:
IOException
-