aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-14 01:38:35 +0800
committerFabio Berger <me@fabioberger.com>2018-07-14 01:38:35 +0800
commit80071beaacd4303bd5c7edb699d202861fd98b50 (patch)
treee115d3113483a9f193e6782cd885ccb57e580bb3 /packages
parentde1029d5ef7f069a2215557e901f3230f6da98fa (diff)
downloaddexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.tar
dexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.tar.gz
dexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.tar.bz2
dexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.tar.lz
dexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.tar.xz
dexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.tar.zst
dexon-sol-tools-80071beaacd4303bd5c7edb699d202861fd98b50.zip
Add assertion to make sure caller to fetchAsync isn't trying to set timeout in a context-specific way
Diffstat (limited to 'packages')
-rw-r--r--packages/utils/src/fetchAsync.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/utils/src/fetchAsync.ts b/packages/utils/src/fetchAsync.ts
index 8295ff5ec..6ae2ba1a4 100644
--- a/packages/utils/src/fetchAsync.ts
+++ b/packages/utils/src/fetchAsync.ts
@@ -6,6 +6,9 @@ export const fetchAsync = async (
options: RequestInit = {},
timeoutMs: number = 20000,
): Promise<Response> => {
+ if (options.signal || (options as any).timeout) {
+ throw new Error('Cannot call fetchAsync with options.signal or options.timeout. To set a timeout, please use the supplied "timeoutMs" parameter.');
+ }
let optionsWithAbortParam;
if (!isNode) {
const controller = new AbortController();