public abstract class CommandException
extends java.lang.RuntimeException
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_COMMAND_TYPE_NAME
The name of the attribute of the command type reported in an error.
|
Modifier | Constructor and Description |
---|---|
protected |
CommandException(java.lang.String messageText,
io.spine.core.Command command,
io.spine.base.Error error)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
io.spine.base.Error |
asError() |
java.lang.Throwable |
asThrowable() |
static java.util.Map<java.lang.String,com.google.protobuf.Value> |
commandTypeAttribute(com.google.protobuf.Message commandMessage)
Returns a map with a command type attribute.
|
protected static io.spine.base.Error |
createError(java.lang.String format,
io.spine.core.Command command,
io.spine.core.CommandValidationError errorCode) |
io.spine.core.Command |
getCommand()
Returns a related command.
|
protected static java.lang.String |
messageFormat(java.lang.String format,
io.spine.core.Command command)
Builds a formatted string for the passed format and a command.
|
public static final java.lang.String ATTR_COMMAND_TYPE_NAME
CommandException.commandTypeAttribute(Message)
,
Error
,
Constant Field Valuesprotected CommandException(java.lang.String messageText, io.spine.core.Command command, io.spine.base.Error error)
messageText
- an error message textcommand
- a related commanderror
- an error occurredpublic static java.util.Map<java.lang.String,com.google.protobuf.Value> commandTypeAttribute(com.google.protobuf.Message commandMessage)
commandMessage
- a command message to get the type fromprotected static io.spine.base.Error createError(java.lang.String format, io.spine.core.Command command, io.spine.core.CommandValidationError errorCode)
public io.spine.core.Command getCommand()
public io.spine.base.Error asError()
public java.lang.Throwable asThrowable()
protected static java.lang.String messageFormat(java.lang.String format, io.spine.core.Command command)
The first parameter of the formatted string is a ClassName
of the command message.
The second parameter is a TypeName
of the command message.