wrapRequest

internal inline suspend fun <ResponseType : Any> wrapRequest(customErrorInterceptor: ErrorResponseInterceptor<ResponseType>? = null, federationErrorResponseInterceptor: BaseFederationErrorResponseInterceptor<*> = FederationErrorResponseInterceptorConflict, json: <Error class: unknown class> = KtxSerializer.json, performRequest: () -> <Error class: unknown class>): NetworkResponse<ResponseType>


internal inline suspend fun <ResponseType : Any> wrapRequest(customErrorInterceptor: ErrorResponseInterceptor<ResponseType>? = null, federationErrorResponseInterceptor: BaseFederationErrorResponseInterceptor<*> = FederationErrorResponseInterceptorConflict, successHandler: suspend (<Error class: unknown class>) -> NetworkResponse<ResponseType>, json: <Error class: unknown class> = KtxSerializer.json, performRequest: () -> <Error class: unknown class>): NetworkResponse<ResponseType>

Handles an HTTP response with an error status, transforming it into a corresponding NetworkResponse.

Return

A NetworkResponse representing the error, which may either include specific error details or a generic error object.

Parameters

performRequest

An HTTP response producer

customErrorInterceptor

An optional interceptor for custom error responses. This interceptor will be executed after UnauthorizedResponseInterceptor but before other default interceptors like FederationErrorResponseInterceptorConflictWithMissingUsers. This allows overriding the default error handling for specific cases.

successHandler

A handler for successful HTTP responses (status codes 200..299). By default, it will deserialize the body to the wanted ResponseType.