public class ThrowableCause extends AxonException implements Cause
| Modifier and Type | Field and Description |
|---|---|
static int |
TRUNCATED_MESSAGE_SIZE
The default size of
1023 to truncate a Throwable.getMessage() to, to fit into typical dead-letter
storages. |
| Constructor and Description |
|---|
ThrowableCause(String type,
String message)
Constructs a cause based on the give
type and message. |
ThrowableCause(Throwable throwable)
Construct a cause based on the given
throwable. |
| Modifier and Type | Method and Description |
|---|---|
static ThrowableCause |
asCause(Throwable cause)
Return the given
cause as a ThrowableCause. |
boolean |
equals(Object o) |
int |
hashCode() |
String |
message()
A message describing a cause for dead lettering.
|
String |
toString() |
static ThrowableCause |
truncated(Throwable throwable)
Construct a
ThrowableCause based on the given throwable, truncating the message to a maximum size
of TRUNCATED_MESSAGE_SIZE. |
static ThrowableCause |
truncated(Throwable throwable,
int messageSize)
Construct a
ThrowableCause based on the given throwable, truncating the message to the given
messageSize. |
String |
type()
Returns the type of dead lettering cause.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTracepublic static final int TRUNCATED_MESSAGE_SIZE
1023 to truncate a Throwable.getMessage() to, to fit into typical dead-letter
storages.public ThrowableCause(Throwable throwable)
throwable. Uses the fully qualified class name as the
type and the Throwable.getMessage() as the message.throwable - The throwable to base this cause on.public static ThrowableCause asCause(Throwable cause)
cause as a ThrowableCause.
If the given cause is an instance of ThrowableCause it is returned as is. Otherwise, this method
constructs a new instance through ThrowableCause(Throwable).
cause - The Throwable to map to a ThrowableCause.ThrowableCause based on the given cause, or the cause as-is if it is an
instance of ThrowableCause.public static ThrowableCause truncated(Throwable throwable)
ThrowableCause based on the given throwable, truncating the message to a maximum size
of TRUNCATED_MESSAGE_SIZE.
Should be used to ensure the Cause fits in the desired dead-letter storage solution.
throwable - The Throwable to adjust to a ThrowableCause.ThrowableCause based on the given throwable for which the message is truncated to
TRUNCATED_MESSAGE_SIZE.public static ThrowableCause truncated(Throwable throwable, int messageSize)
ThrowableCause based on the given throwable, truncating the message to the given
messageSize.
Should be used to ensure the Cause fits in the desired dead-letter storage solution.
throwable - The Throwable to adjust to a ThrowableCause.messageSize - The size to truncate the Throwable.getMessage() to, to be able to fit in databases.ThrowableCause based on the given throwable for which the message is truncated to given
messageSize.public String type()
Causetype can, for example, reflect the fully qualified class
name of a Throwable.public String message()
Causemessage() can, for example, reflect the message of a
Throwable.Copyright © 2010–2023. All rights reserved.