public class InvalidCommandException extends CommandException
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.
ATTR_COMMAND_TYPE_NAME
Modifier and Type | Method and Description |
---|---|
static InvalidCommandException |
inapplicableTenantId(io.spine.core.Command command)
Creates an exception for the command which specifies a tenant in a single-tenant context.
|
static InvalidCommandException |
missingTenantId(io.spine.core.Command command)
Creates an exception for a command with missing
tenant_id attribute in
the CommandContext which is required in a multitenant application. |
static InvalidCommandException |
onConstraintViolations(io.spine.core.Command command,
java.lang.Iterable<io.spine.validate.ConstraintViolation> violations)
Creates an exception instance for a command message,
which has fields that violate validation constraint(s).
|
static io.spine.base.Error |
unknownTenantError(com.google.protobuf.Message commandMessage,
java.lang.String errorText)
Creates an error for a command with missing
tenant_id
attribute in the CommandContext which is required in a multitenant application. |
asError, asThrowable, commandTypeAttribute, createError, getCommand, messageFormat
public static InvalidCommandException onConstraintViolations(io.spine.core.Command command, java.lang.Iterable<io.spine.validate.ConstraintViolation> violations)
command
- an invalid commandviolations
- constraint violations for the command messagepublic static InvalidCommandException missingTenantId(io.spine.core.Command command)
tenant_id
attribute in
the CommandContext
which is required in a multitenant application.public static io.spine.base.Error unknownTenantError(com.google.protobuf.Message commandMessage, java.lang.String errorText)
tenant_id
attribute in the CommandContext
which is required in a multitenant application.public static InvalidCommandException inapplicableTenantId(io.spine.core.Command command)