Module: YandexTracker::Errors

Defined in:
lib/yandex_tracker/errors.rb

Overview

Custom error classes and error formatting for the API client

Defined Under Namespace

Classes: ApiError, ArgumentError, AuthError, ConfigurationError, ConnectionError, ContextError, Error, NotFound, ResourceError, TimeoutError, Unauthorized

Class Method Summary collapse

Class Method Details

.format_message(body) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/yandex_tracker/errors.rb', line 22

def format_message(body)
  return body.to_s unless body.is_a?(Hash)

  # TODO: {"errors"=>{"type"=>"Требуется параметр.", "category"=>"Требуется параметр."}, \
  # "errorsData"=>{}, "errorMessages"=>[], "statusCode"=>422}
  body["errorMessages"]&.join(", ") || body["message"] || body.to_s
end