class Crm::Errors::ItemStatePreconditionFailed

ItemStatePreconditionFailed is raised if one or more preconditions for the attempted action were not satisfied. @api public

Attributes

unmet_preconditions[R]

Returns the unmet preconditions. The items in the list are hashes consisting of a code (the name of the precondition), and an English translation (message). @return [Array<Hash{String => String}>] @example

[
  {
    "code" => "is_internal_mailing",
    "message" => "The mailing is not an internal mailing.",
  },
]

@api public

Public Class Methods

new(message = nil, unmet_preconditions) click to toggle source
Calls superclass method
# File lib/crm/errors.rb, line 78
def initialize(message = nil, unmet_preconditions)
  precondition_messages = unmet_preconditions.map{ |p| p['message'] }
  new_message = ([message] + precondition_messages).join(' ')
  super(new_message)

  @unmet_preconditions = unmet_preconditions
end