refactor: remove redundant error in catch (#25478)

PR Close #25478
This commit is contained in:
Alan Agius
2018-08-14 15:34:51 +02:00
committed by Kara Erickson
parent 929334b0bf
commit b61dafaeac
15 changed files with 28 additions and 28 deletions

View File

@ -212,7 +212,7 @@ export abstract class AssetGroup {
// Check the metadata table. If a timestamp is there, use it.
const metaTable = await this.metadata;
ts = (await metaTable.read<UrlMetadata>(req.url)).ts;
} catch (e) {
} catch {
// Otherwise, look for a Date header.
const date = res.headers.get('Date');
if (date === null) {
@ -224,7 +224,7 @@ export abstract class AssetGroup {
}
const age = this.adapter.time - ts;
return age < 0 || age > maxAge;
} catch (e) {
} catch {
// Assume stale.
return true;
}
@ -235,7 +235,7 @@ export abstract class AssetGroup {
// The request needs to be revalidated if the current time is later than the expiration
// time, if it parses correctly.
return this.adapter.time > Date.parse(expiresStr);
} catch (e) {
} catch {
// The expiration date failed to parse, so revalidate as a precaution.
return true;
}
@ -263,7 +263,7 @@ export abstract class AssetGroup {
let metadata: UrlMetadata|undefined = undefined;
try {
metadata = await metaTable.read<UrlMetadata>(url);
} catch (e) {
} catch {
// Do nothing, not found. This shouldn't happen, but it can be handled.
}
@ -487,7 +487,7 @@ export abstract class AssetGroup {
protected async safeFetch(req: Request): Promise<Response> {
try {
return await this.scope.fetch(req);
} catch (err) {
} catch {
return this.adapter.newResponse('', {
status: 504,
statusText: 'Gateway Timeout',

View File

@ -258,7 +258,7 @@ export class DataGroup {
const table = await this.lruTable;
try {
this._lru = new LruList(await table.read<LruState>('lru'));
} catch (e) {
} catch {
this._lru = new LruList();
}
}
@ -371,7 +371,7 @@ export class DataGroup {
// If that fetch errors, treat it as a timed out request.
try {
res = await timeoutFetch;
} catch (e) {
} catch {
res = undefined;
}
@ -407,7 +407,7 @@ export class DataGroup {
const safeNetworkFetch = (async() => {
try {
return await networkFetch;
} catch (err) {
} catch {
return this.adapter.newResponse(null, {
status: 504,
statusText: 'Gateway Timeout',
@ -417,7 +417,7 @@ export class DataGroup {
const networkFetchUndefinedError = (async() => {
try {
return await networkFetch;
} catch (err) {
} catch {
return undefined;
}
})();
@ -436,7 +436,7 @@ export class DataGroup {
private async safeCacheResponse(req: Request, res: Promise<Response>): Promise<void> {
try {
await this.cacheResponse(req, await res, await this.lru());
} catch (e) {
} catch {
// TODO: handle this error somehow?
}
}
@ -460,7 +460,7 @@ export class DataGroup {
}
// Otherwise, or if there was an error, assume the response is expired, and evict it.
} catch (e) {
} catch {
// Some error getting the age for the response. Assume it's expired.
}
@ -546,7 +546,7 @@ export class DataGroup {
private async safeFetch(req: Request): Promise<Response> {
try {
return this.scope.fetch(req);
} catch (err) {
} catch {
return this.adapter.newResponse(null, {
status: 504,
statusText: 'Gateway Timeout',