Skip to content
Snippets Groups Projects
Commit 18db901b authored by Alexander Rose's avatar Alexander Rose
Browse files

declaration test

parent 8603ef1a
Branches
Tags
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @author David Sehnal <david.sehnal@gmail.com> * @author David Sehnal <david.sehnal@gmail.com>
*/ */
import fetch from 'node-fetch'; import fetch, { Response } from 'node-fetch';
import { retryIf } from '../../../mol-util/retry-if'; import { retryIf } from '../../../mol-util/retry-if';
const RETRIABLE_NETWORK_ERRORS = [ const RETRIABLE_NETWORK_ERRORS = [
...@@ -16,7 +16,7 @@ function isRetriableNetworkError(error: any) { ...@@ -16,7 +16,7 @@ function isRetriableNetworkError(error: any) {
return error && RETRIABLE_NETWORK_ERRORS.includes(error.code); return error && RETRIABLE_NETWORK_ERRORS.includes(error.code);
} }
export async function fetchRetry(url: string, timeout: number, retryCount: number) { export async function fetchRetry(url: string, timeout: number, retryCount: number): Promise<Response> {
const result = await retryIf(() => fetch(url, { timeout }), { const result = await retryIf(() => fetch(url, { timeout }), {
retryThenIf: r => r.status >= 500 && r.status < 600, retryThenIf: r => r.status >= 500 && r.status < 600,
// TODO test retryCatchIf // TODO test retryCatchIf
......
{ {
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"declaration": true,
"target": "es5", "target": "es5",
"alwaysStrict": true, "alwaysStrict": true,
"noImplicitAny": true, "noImplicitAny": true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment