InvalidCommandException

The exception for reporting invalid commands.

A command is invalid if it's supported (there's a handler for the command), but its attributes are not populated according to framework conventions or validation constraints.

Inherited properties

Link copied to clipboard
public final static String ATTR_COMMAND_TYPE_NAME
The name of the attribute of the command type reported in an error.
Link copied to clipboard
Link copied to clipboard
public final Command command
Link copied to clipboard

Functions

Link copied to clipboard
public static InvalidCommandException inapplicableTenantId(Command command)
Creates an exception for the command which specifies a tenant in a single-tenant context.
Link copied to clipboard
public static InvalidCommandException missingTenantId(Command command)
Creates an exception for a command with missing tenant_id attribute in the CommandContext which is required in a multitenant application.
Link copied to clipboard
public static InvalidCommandException onConstraintViolations(Command command, Iterable<ConstraintViolation> violations)
Creates an exception instance for a command message, which has fields that violate validation constraint(s).
Link copied to clipboard
public static Error unknownTenantError(Message commandMessage, String errorText)
Creates an error for a command with missing tenant_id attribute in the CommandContext which is required in a multitenant application.

Inherited functions

Link copied to clipboard
public final synchronized void addSuppressed(Throwable exception)
Link copied to clipboard
public Error asError()
Converts this instance into an io.spine.base.Error.
Link copied to clipboard
Converts this instance into a java.lang.Throwable.
Link copied to clipboard
public static Map<String, Value> commandTypeAttribute(Message commandMessage)
Returns a map with a command type attribute.
Link copied to clipboard
protected static Error createError(String format, Command command, CommandValidationError errorCode)
Link copied to clipboard
public synchronized Throwable fillInStackTrace()
Link copied to clipboard
public synchronized Throwable getCause()
Link copied to clipboard
public Command getCommand()
Returns a related command.
Link copied to clipboard
Link copied to clipboard
public String getMessage()
Link copied to clipboard
Link copied to clipboard
public final synchronized Array<Throwable> getSuppressed()
Link copied to clipboard
public synchronized Throwable initCause(Throwable cause)
Link copied to clipboard
protected static String messageFormat(String format, Command command)
Builds a formatted string for the passed format and a command.
Link copied to clipboard
public void printStackTrace()
Link copied to clipboard
public void setStackTrace(Array<StackTraceElement> stackTrace)
Link copied to clipboard
public String toString()