Exception: Travis::Client::ValidationFailed
- Defined in:
- lib/travis/client/error.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(message = nil, *args) ⇒ ValidationFailed
constructor
A new instance of ValidationFailed.
- #parse_message(message) ⇒ Object
Constructor Details
#initialize(message = nil, *args) ⇒ ValidationFailed
Returns a new instance of ValidationFailed.
41 42 43 44 |
# File 'lib/travis/client/error.rb', line 41 def initialize( = nil, *args) = () if super(, *args) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
39 40 41 |
# File 'lib/travis/client/error.rb', line 39 def errors @errors end |
Instance Method Details
#parse_message(message) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/travis/client/error.rb', line 46 def () response = JSON.parse() = response['message'].to_s if (@errors = response['errors']) && @errors.any? readable = @errors.map { |e| "#{e['field']}: #{e['code'].gsub('_', ' ')}" } += " (#{readable.join(', ')})" end rescue JSON::ParserError end |