Module: Gladly::Api::ErrorHandling

Included in:
Client
Defined in:
app/services/gladly/api/error_handling.rb

Instance Method Summary collapse

Instance Method Details

#net_http_errorsObject

rubocop:disable Layout/LineLength



7
8
9
# File 'app/services/gladly/api/error_handling.rb', line 7

def net_http_errors
  %w[Timeout::Error Errno::EINVAL Errno::ECONNRESET EOFError Net::HTTPBadResponse Net::HTTPHeaderSyntaxError Net::ProtocolError Net::HTTPUnauthorized]
end

#not_implemented_errorObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'app/services/gladly/api/error_handling.rb', line 16

def not_implemented_error
  raise NotImplementedError
end

#parse_error(error:) ⇒ Object

rubocop:enable Layout/LineLength



12
13
14
# File 'app/services/gladly/api/error_handling.rb', line 12

def parse_error(error:)
  { errors: [{ code: error.code, detail: error.msg }] }
end