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.
20 21 22 23 |
# File 'lib/travis/client/error.rb', line 20 def initialize( = nil, *args) = () if super(, *args) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
18 19 20 |
# File 'lib/travis/client/error.rb', line 18 def errors @errors end |
Instance Method Details
#parse_message(message) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/travis/client/error.rb', line 25 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 |