How to use the ky-universal.TimeoutError.name function in ky-universal

To help you get started, we’ve selected a few ky-universal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vadimdemedes / draqula / src / Draqula.ts View on Github external
retries = 0;
		}

		if (retries === 0) {
			return execute();
		}

		try {
			return await pRetry(execute, {
				retries
			});
		} catch (error) {
			// Convenience wrapper for easier checks between network and GraphQL errors,
			// since most applications won't actually differentiate between HTTP and timeout error types,
			// however the original error is still accessible via `.originalError` property
			if (error.name === HTTPError.name || error.name === TimeoutError.name) {
				throw new NetworkError(error);
			}

			throw error;
		}
	}