Exception: Typesafe::UnprocessableEntityError

Inherits:
APIError
  • Object
show all
Defined in:
lib/typesafe/errors.rb

Overview

The request body failed server-side validation (422).

Instance Attribute Summary

Attributes inherited from APIError

#body, #headers, #request_id, #status

Instance Method Summary collapse

Methods inherited from APIError

#initialize, #retryable?

Constructor Details

This class inherits a constructor from Typesafe::APIError

Instance Method Details

#errorsArray<Hash>

The parsed validation entries, e.g. {"type" => "missing", "loc" => ["body", "questions"], "msg" => "Field required"}; empty when the body carries none.

Returns:

  • (Array<Hash>)


81
82
83
84
# File 'lib/typesafe/errors.rb', line 81

def errors
  detail = body.is_a?(Hash) ? body["detail"] : nil
  detail.is_a?(Array) ? detail : []
end