Class: Github::Client::EntityError

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/github/client.rb

Constant Summary collapse

MISSING =
"missing"
MISSING_FIELD =
"missing_field"
INVALID =
"invalid"
ALREADY_EXISTS =
"already_exists"

Instance Method Summary collapse

Instance Method Details

#descriptionObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/github/client.rb', line 126

def description
  case self.code
    when MISSING
      "#{self.resource} is missing"
    when MISSING_FIELD
      "#{self.resource}##{self.field} is missing"
    when INVALID
      "#{self.resource}##{self.field} is invalid (refer to documentation)"
    when ALREADY_EXISTS
      "#{self.resource}##{self.field} value is already taken (must be unique)"
    else
      "#{self.resource}##{self.field} error: #{self.code}"
  end
end

#to_sObject



122
123
124
# File 'lib/github/client.rb', line 122

def to_s
  "<Github::Client::EntityError: #{description}>"
end