lib/rundeck/request.rb in rundeck-0.0.3.pre vs lib/rundeck/request.rb in rundeck-0.0.3
- old
+ new
@@ -83,11 +83,17 @@
options[:headers].merge!('Accept' => 'application/xml')
end
end
def error_message(response)
+ message = if response.parsed_response && response.parsed_response['result']
+ response.parsed_response['result']['error'][1]['message']
+ else
+ 'none'
+ end
+
"Server responded with code #{response.code}, " \
- "message: #{response.parsed_response['result']['error'][1]['message']}. " \
+ "message: #{message}. " \
"Request URI: #{response.request.base_uri}#{response.request.path}"
end
end
end