Skip to content

Commit

Permalink
More debug information in timeout and fetch errors (#678).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jun 12, 2020
1 parent 5e7d28b commit 693094e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/web/src.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ export function fetchJson(connection: string | ConnectionInfo, json?: string, pr
if (timer == null) { return; }
timer = null;

reject(logger.makeError("timeout", Logger.errors.TIMEOUT, { timeout: timeout }));
reject(logger.makeError("timeout", Logger.errors.TIMEOUT, {
requestBody: (options.body || null),
requestMethod: options.method,
timeout: timeout,
url: url
}));
}, timeout);
}
});
Expand All @@ -146,6 +151,8 @@ export function fetchJson(connection: string | ConnectionInfo, json?: string, pr
if (response == null) {
runningTimeout.cancel();
logger.throwError("missing response", Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestMethod: options.method,
serverError: error,
url: url
});
Expand All @@ -164,6 +171,8 @@ export function fetchJson(connection: string | ConnectionInfo, json?: string, pr
status: response.statusCode,
headers: response.headers,
body: body,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
Expand All @@ -178,6 +187,8 @@ export function fetchJson(connection: string | ConnectionInfo, json?: string, pr
logger.throwError("invalid JSON", Logger.errors.SERVER_ERROR, {
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
Expand All @@ -189,7 +200,10 @@ export function fetchJson(connection: string | ConnectionInfo, json?: string, pr
} catch (error) {
logger.throwError("processing response error", Logger.errors.SERVER_ERROR, {
body: json,
error: error
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
}
Expand Down

0 comments on commit 693094e

Please sign in to comment.