UNPKG

@uppy/utils

Version:

Shared utility functions for Uppy Core and plugins maintained by the Uppy team.

15 lines (14 loc) 385 B
import NetworkError from './NetworkError.js'; /** * Wrapper around window.fetch that throws a NetworkError when appropriate */ export default function fetchWithNetworkError(...options) { return fetch(...options).catch((err) => { if (err.name === 'AbortError') { throw err; } else { throw new NetworkError(err); } }); }