Sha256: 9e35e341529fd4e083b2afd2d7fd85557995e3bc4cce1f87d7e6e1bf6caba112
Contents?: true
Size: 897 Bytes
Versions: 27
Compression:
Stored size: 897 Bytes
Contents
# *Flexirest:* HTTP/parse error handling Sometimes the backend server may respond with a non-200/304 header, in which case the code will raise an `Flexirest::HTTPClientException` for 4xx errors or an `Flexirest::HTTPServerException` for 5xx errors. These both have a `status` accessor and a `result` accessor (for getting access to the parsed body): ```ruby begin Person.all rescue Flexirest::HTTPClientException, Flexirest::HTTPServerException => e Rails.logger.error("API returned #{e.status} : #{e.result.message}") end ``` If the response is unparsable (e.g. not in the desired content type), then it will raise an `Flexirest::ResponseParseException` which has a `status` accessor for the HTTP status code and a `body` accessor for the unparsed response body. ----- [< Updating only changed/dirty attributes](updating-only-changed-dirty-attributes.md) | [Validation >](validation.md)
Version data entries
27 entries across 27 versions & 1 rubygems