Core
createNetworkFault
Builds a NET_* PreflightFault, choosing the code from the shape of cause.
@defjs/core · Function
Signature
function createNetworkFault( cause: unknown, response?: HttpMeta, ): PreflightFault;
Optional response metadata is attached when the transport already had some
to report. The cause is kept as cause.
NET_ABORTEDwhen isAbortCause recognizes an abort-brandedError(includingERR_ABORTEDfrom another Core copy) or aDOMExceptionnamedAbortError. The message isRequest was aborted.NET_TIMEOUTwhen isTimeoutCause recognizes a timeout-brandedError(includingERR_TIMEOUTfrom another Core copy) or aDOMExceptionorErrornamedTimeoutError. The message is the cause's message, orRequest timed outwhen that is empty.NET_UNREACHABLEfor anything else, with the cause's message.
Parameters
Prop
Type
cause unknownUnderlying cancellation, timeout, or transport failure.
response? HttpMetaMetadata, only where the transport already had some to report.
Returns
A NET_ABORTED, NET_TIMEOUT, or NET_UNREACHABLE fault.