abstract class Amazonite::Core::ResponseExceptionFactory

Overview

Builds the ResponseException for an error response. Each generated service module has its own subclass implementing #create to map the service's exception type name to its generated exception class; Client calls #build on that instance whenever a request fails.

Direct Known Subclasses

Defined in:

core/response_exception_factory.cr

Instance Method Summary

Instance Method Detail

def build(response : HTTP::Client::Response) : ResponseException #

Builds the exception for a JSON (awsJson/rest-json) error response, dispatching on the x-amzn-errortype header or the body's __type field via #create.


[View source]
abstract def create(exception_type : String | Nil, http : HTTP::Client::Response, message : String | Nil, code : String | Nil) : ResponseException | Nil #

Returns the specific exception for exception_type (the service's exception type name, e.g. "ResourceNotFoundException"), or nil if the service doesn't declare that exception type - in which case #build falls back to a generic ResponseException.


[View source]