class Cuprum::Collections::Errors::InvalidParameters
An error returned when a command is called with invalid parameters.
Constants
- TYPE
Short string used to identify the type of error.
Attributes
command[R]
@return [Cuprum::Command] the called command.
errors[R]
@return [Stannum::Errors] the errors returned by the parameters contract.
Public Class Methods
new(command:, errors:)
click to toggle source
@param command [Cuprum::Command] the called command. @param errors [Stannum::Errors] the errors returned by the parameters
contract.
Calls superclass method
# File lib/cuprum/collections/errors/invalid_parameters.rb, line 16 def initialize(command:, errors:) @command = command @errors = errors super( command: command, errors: errors, message: "invalid parameters for command #{command.class}" ) end
Public Instance Methods
as_json()
click to toggle source
@return [Hash] a serializable hash representation of the error.
# File lib/cuprum/collections/errors/invalid_parameters.rb, line 28 def as_json { 'data' => { 'command_class' => command.class.name, 'errors' => errors.to_a }, 'message' => message, 'type' => type } end
type()
click to toggle source
@return [String] short string used to identify the type of error.
# File lib/cuprum/collections/errors/invalid_parameters.rb, line 46 def type TYPE end