ResponseErrorBodyWrapper

@propertyWrapper
public struct ResponseErrorBodyWrapper<Body, BodyStrategy> where Body : Decodable, BodyStrategy : ResponseErrorBodyDecodingStrategy
extension ResponseErrorBodyWrapper: Decodable

A property wrapper that wraps an error response body.

The ResponseErrorBodyWrapper property wrapper is used to wrap an error response body value. It provides a wrappedValue property that holds the error response body value.

Example usage:

@ResponseErrorBodyWrapper var errorResponseBody: MyErrorResponseType?
  • The wrapped value representing the decoded error response body.

    This property holds the decoded error response body that is managed by this property wrapper.

    Declaration

    Swift

    public var wrappedValue: Body?
  • Initializes a new instance of ResponseErrorBodyWrapper with a nil value.

    Example usage:

    @ResponseErrorBodyWrapper var errorResponseBody: MyErrorResponseType?
    

    Declaration

    Swift

    public init()
  • Initializes a new instance of ResponseErrorBodyWrapper with the specified wrapped value.

    Example usage:

    @ResponseErrorBodyWrapper var errorResponseBody: MyErrorResponseType? = MyErrorResponseType()
    

    Declaration

    Swift

    public init(wrappedValue: Body?)

    Parameters

    wrappedValue

    The wrapped value representing the decoded error response body.

Decodable

  • Initializes a new instance of ResponseErrorBodyWrapper from a decoder.

    Throws

    An error if the decoder is not a ResponseDecoding instance or if the response body cannot be decoded.

    Declaration

    Swift

    public init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to use for decoding the error response body.