Package org.spongepowered.api.util
Class ComponentMessageException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.spongepowered.api.util.ComponentMessageException
-
- All Implemented Interfaces:
java.io.Serializable
,ComponentMessageThrowable
- Direct Known Subclasses:
CommandException
public class ComponentMessageException extends java.lang.Exception implements ComponentMessageThrowable
A subclass of Exception that contains a rich message that is an instance ofComponent
rather than a String. This allows formatted and localized exception messages.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ComponentMessageException()
Constructs a newComponentMessageException
.ComponentMessageException(java.lang.Throwable throwable)
Constructs a newComponentMessageException
with the given cause.ComponentMessageException(Component message)
Constructs a newComponentMessageException
with the given message.ComponentMessageException(Component message, java.lang.Throwable throwable)
Constructs a newComponentMessageException
with the given message and cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Component
componentMessage()
Returns the text message for this exception, or null if nothing is present.@Nullable java.lang.String
getLocalizedMessage()
@Nullable java.lang.String
getMessage()
-
-
-
Constructor Detail
-
ComponentMessageException
public ComponentMessageException()
Constructs a newComponentMessageException
.
-
ComponentMessageException
public ComponentMessageException(Component message)
Constructs a newComponentMessageException
with the given message.- Parameters:
message
- The detail message
-
ComponentMessageException
public ComponentMessageException(Component message, java.lang.Throwable throwable)
Constructs a newComponentMessageException
with the given message and cause.- Parameters:
message
- The detail messagethrowable
- The cause
-
ComponentMessageException
public ComponentMessageException(java.lang.Throwable throwable)
Constructs a newComponentMessageException
with the given cause.- Parameters:
throwable
- The cause
-
-
Method Detail
-
getMessage
public @Nullable java.lang.String getMessage()
- Overrides:
getMessage
in classjava.lang.Throwable
-
componentMessage
public @Nullable Component componentMessage()
Returns the text message for this exception, or null if nothing is present.- Specified by:
componentMessage
in interfaceComponentMessageThrowable
- Returns:
- The text for this message
-
getLocalizedMessage
public @Nullable java.lang.String getLocalizedMessage()
- Overrides:
getLocalizedMessage
in classjava.lang.Throwable
-
-