@SuppressWarnings("unchecked")
    private List<ApiGatewayErrorUnmarshaller> createErrorUnmarshallers(
            Stream<JsonErrorShapeMetadata> errorShapeMetadata) {
        final List<ApiGatewayErrorUnmarshaller> errorUnmarshallers = errorShapeMetadata
                .map(this::createErrorUnmarshaller).collect(Collectors.toList());
        // All unmodeled/unknown exceptions are unmarshalled into the service specific base
        // exception class.
        errorUnmarshallers.add(new ApiGatewayErrorUnmarshaller(
                (Class<? extends BaseException>) metadata.getBaseServiceExceptionClass(),
                Optional.empty()));
        return errorUnmarshallers;
    }
Creates a response handler for handling a error response (non 2xx response).
aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/protect/protocol/ApiGatewayProtocolFactoryImpl.java