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