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.
23 24 25 26 |
# File 'lib/travis/client/error.rb', line 23 def initialize( = nil, *args) = () if super(, *args) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
21 22 23 |
# File 'lib/travis/client/error.rb', line 21 def errors @errors end |
Instance Method Details
#parse_message(message) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/travis/client/error.rb', line 28 def () response = JSON.load() = response['message'].to_s if @errors = response['errors'] and @errors.any? readable = @errors.map { |e| "#{e['field']}: #{e['code'].gsub('_', ' ')}" } += " (#{readable.join(', ')})" end rescue JSON::ParserError end |