class Sequent::Core::CommandNotValid

Raised when BaseCommand.valid? returns false

Attributes

command[R]

Public Class Methods

new(command) click to toggle source
Calls superclass method
# File lib/sequent/core/command_service.rb, line 118
def initialize(command)
  @command = command
  msg = @command.respond_to?(:aggregate_id) ? " #{@command.aggregate_id}" : ''
  super "Invalid command #{@command.class}#{msg}, errors: #{@command.validation_errors}"
end

Public Instance Methods

errors(prefix = nil) click to toggle source
# File lib/sequent/core/command_service.rb, line 124
def errors(prefix = nil)
  I18n.with_locale(Sequent.configuration.error_locale_resolver.call) do
    @command.validation_errors(prefix)
  end
end
errors_with_command_prefix() click to toggle source
# File lib/sequent/core/command_service.rb, line 130
def errors_with_command_prefix
  errors(@command.class.to_s.underscore)
end