Skip to content

Commit 7a7c0a9

Browse files
committed
fix lint
1 parent ebb1fd7 commit 7a7c0a9

13 files changed

Lines changed: 27 additions & 12 deletions

File tree

lib/utils/catchAndReport.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1-
import HawkCatcher from "@hawk.so/nodejs";
2-
import { Worker } from "../worker";
1+
import HawkCatcher from '@hawk.so/nodejs';
2+
import { Worker } from '../worker';
33

4+
//
5+
// Catches unhandled exceptions from the decorated method, sends them to HawkCatcher
6+
// with the current worker’s type, and re‑throws.
7+
//
48
/**
5-
* Catches unhandled exceptions from the decorated method, sends them to HawkCatcher
6-
* with the current worker’s type, and re‑throws.
7-
*/
9+
*
10+
*/
811
export function catchAndReport(): MethodDecorator {
912
return function (_target, propertyKey, descriptor) {
1013
const original = descriptor.value;
1114

12-
if (typeof original !== "function") {
15+
if (typeof original !== 'function') {
1316
throw new Error(
1417
`@catchAndReport can only be applied to methods (${String(propertyKey)})`
15-
)
18+
);
1619
}
1720

1821
descriptor.value = async function (...args: any[]) {
1922
try {
2023
return await original.apply(this, args);
2124
} catch (error) {
2225
HawkCatcher.send(error, {
23-
workerType: (this as Worker).type
26+
workerType: (this as Worker).type,
2427
});
2528
throw error;
2629
}
2730
} as typeof original;
28-
}
29-
};
31+
};
32+
}

runner.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class WorkerRunner {
194194
utils.sendReport(worker.constructor.name + ' started');
195195
} catch (startingError) {
196196
this.exceptionHandler(startingError, {
197-
workerType: worker.type
197+
workerType: worker.type,
198198
});
199199

200200
utils.sendReport(worker.constructor.name + ' failed to start');
@@ -211,6 +211,7 @@ class WorkerRunner {
211211
* - Unhandled Promise Rejection at Runner work
212212
*
213213
* @param error - error to handle
214+
* @param context
214215
*/
215216
private exceptionHandler(error: Error, context?: EventContext): void {
216217
HawkCatcher.send(error, context);
@@ -289,7 +290,7 @@ class WorkerRunner {
289290
);
290291
} catch (finishingError) {
291292
HawkCatcher.send(finishingError, {
292-
workerType: worker.type
293+
workerType: worker.type,
293294
});
294295
console.error('Error while finishing Worker: ', finishingError);
295296
}

workers/archiver/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as dotenv from 'dotenv';
99
import prettysize from 'prettysize';
1010
import { ProjectDBScheme } from '@hawk.so/types';
1111
import { HOURS_IN_DAY, MINUTES_IN_HOUR, MS_IN_SEC, SECONDS_IN_MINUTE } from '../../../lib/utils/consts';
12+
// eslint-disable-next-line no-unused-vars
1213
import { catchAndReport } from '../../../lib/utils/catchAndReport';
1314

1415
dotenv.config({ path: path.resolve(__dirname, '../.env') });

workers/default/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ErrorsCatcherType } from '@hawk.so/types';
22
import { EventWorker } from '../../../lib/event-worker';
33
import * as pkg from '../package.json';
44
import { DefaultEventWorkerTask } from '../types/default-event-worker-task';
5+
// eslint-disable-next-line no-unused-vars
56
import { catchAndReport } from '../../../lib/utils/catchAndReport';
67

78
/**

workers/grouper/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { hasValue } from '../../../lib/utils/hasValue';
3131
*/
3232
/* eslint-disable-next-line no-unused-vars */
3333
import { memoize } from '../../../lib/memoize';
34+
// eslint-disable-next-line no-unused-vars
3435
import { catchAndReport } from '../../../lib/utils/catchAndReport';
3536

3637
/**

workers/javascript/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { beautifyUserAgent, getFunctionContext } from './utils';
1414
import { Collection } from 'mongodb';
1515
/* eslint-disable-next-line no-unused-vars */
1616
import { memoize } from '../../../lib/memoize';
17+
// eslint-disable-next-line no-unused-vars
1718
import { catchAndReport } from '../../../lib/utils/catchAndReport';
1819

1920
/**

workers/limiter/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { WorkspaceWithTariffPlan } from '../types';
1313
import * as WorkerNames from '../../../lib/workerNames';
1414
import { DbHelper } from './dbHelper';
1515
import * as telegram from '../../../lib/utils/telegram';
16+
// eslint-disable-next-line no-unused-vars
1617
import { catchAndReport } from '../../../lib/utils/catchAndReport';
1718

1819
dotenv.config({ path: path.resolve(__dirname, '../.env') });

workers/notifier/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { SenderWorkerTask } from 'hawk-worker-sender/types/sender-task';
1111
import RuleValidator from './validator';
1212
import TimeMs from '../../../lib/utils/time';
1313
import RedisHelper from './redisHelper';
14+
// eslint-disable-next-line no-unused-vars
1415
import { catchAndReport } from '../../../lib/utils/catchAndReport';
1516

1617
/**

workers/paymaster/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import axios from 'axios';
1010
import * as WorkerNames from '../../../lib/workerNames';
1111
import HawkCatcher from '@hawk.so/nodejs';
1212
import { countDaysBeforePayday, countDaysAfterPayday, countDaysAfterBlock } from '../../../lib/utils/payday';
13+
// eslint-disable-next-line no-unused-vars
1314
import { catchAndReport } from '../../../lib/utils/catchAndReport';
1415

1516
dotenv.config({

workers/release/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as pkg from '../package.json';
1111
import { ReleaseWorkerTask, ReleaseWorkerAddReleasePayload, CommitDataUnparsed } from '../types';
1212
import { Collection, MongoClient, MongoError } from 'mongodb';
1313
import { SourceMapDataExtended, SourceMapFileChunk, CommitData, SourcemapCollectedData, ReleaseDBScheme } from '@hawk.so/types';
14+
// eslint-disable-next-line no-unused-vars
1415
import { catchAndReport } from '../../../lib/utils/catchAndReport';
1516

1617
/**

0 commit comments

Comments
 (0)