Exception: HumanError::Errors::AssociationError

Inherits:
RequestError
  • Object
show all
Includes:
CrudError
Defined in:
lib/human_error/errors/crud_errors/association_error.rb

Instance Attribute Summary collapse

Attributes included from CrudError

#action, #resource_id, #resource_name

Attributes included from HumanError::Error

#api_error_documentation_url, #api_version, #code, #knowledgebase_article_id, #knowledgebase_url, #message

Instance Method Summary collapse

Methods included from CrudError

#initialize

Methods inherited from RequestError

#as_json

Methods included from HumanError::Error

#customer_support_uri, #developer_documentation_uri, included, #initialize, #to_json, #to_s

Instance Attribute Details

#association_idObject

Returns the value of attribute association_id.



9
10
11
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 9

def association_id
  @association_id
end

#association_nameObject

Returns the value of attribute association_name.



9
10
11
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 9

def association_name
  @association_name
end

#attributesObject

Returns the value of attribute attributes.



9
10
11
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 9

def attributes
  @attributes
end

Instance Method Details

#developer_detailsObject



21
22
23
24
25
26
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 21

def developer_details
  {
    resource_name            => attributes,
    "#{association_name} id" => association_id
  }
end

#developer_messageObject



17
18
19
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 17

def developer_message
  "The #{association_name} that you attempted to associate with the #{resource_name} was not valid."
end

#friendly_messageObject



28
29
30
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 28

def friendly_message
  "Sorry! There was a problem when we tried to set the #{association_name} on that #{resource_name}."
end

#http_statusObject



13
14
15
# File 'lib/human_error/errors/crud_errors/association_error.rb', line 13

def http_status
  422
end