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
ResponseErrorBodyWrapperwith a nil value.Example usage:
@ResponseErrorBodyWrapper var errorResponseBody: MyErrorResponseType?Declaration
Swift
public init() -
Initializes a new instance of
ResponseErrorBodyWrapperwith the specified wrapped value.Example usage:
@ResponseErrorBodyWrapper var errorResponseBody: MyErrorResponseType? = MyErrorResponseType()Declaration
Swift
public init(wrappedValue: Body?)Parameters
wrappedValueThe wrapped value representing the decoded error response body.
-
Initializes a new instance of
ResponseErrorBodyWrapperfrom a decoder.Throws
An error if the decoder is not aResponseDecodinginstance or if the response body cannot be decoded.Declaration
Swift
public init(from decoder: Decoder) throwsParameters
decoderThe decoder to use for decoding the error response body.
View on GitHub