Skip to content

Commit f7e7e0b

Browse files
Just rename all catch (err) to catch (e) (#2888)
According to code style guide Co-authored-by: Max Hauser <[email protected]>
1 parent 04b9a1f commit f7e7e0b

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

packages/adapter/src/lib/adapter/adapter.ts

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,8 +2846,8 @@ export class AdapterClass extends EventEmitter {
28462846
if (options.obj.type !== 'meta') {
28472847
try {
28482848
this._utils.validateId(options.id, false, null);
2849-
} catch (err) {
2850-
this._logger.error(tools.appendStackTrace(`${this.namespaceLog} ${err.message}`));
2849+
} catch (e) {
2850+
this._logger.error(tools.appendStackTrace(`${this.namespaceLog} ${e.message}`));
28512851
return;
28522852
}
28532853
}
@@ -3478,8 +3478,8 @@ export class AdapterClass extends EventEmitter {
34783478

34793479
try {
34803480
this._utils.validateId(id, true, null);
3481-
} catch (err) {
3482-
return tools.maybeCallbackWithError(callback, err);
3481+
} catch (e) {
3482+
return tools.maybeCallbackWithError(callback, e);
34833483
}
34843484

34853485
Validator.assertString(id, 'id');
@@ -3725,8 +3725,8 @@ export class AdapterClass extends EventEmitter {
37253725

37263726
try {
37273727
this._utils.validateId(id, false, null);
3728-
} catch (err) {
3729-
return tools.maybeCallbackWithError(callback, err);
3728+
} catch (e) {
3729+
return tools.maybeCallbackWithError(callback, e);
37303730
}
37313731

37323732
this.#objects.getObject(this._utils.fixId(id), options, callback);
@@ -4419,8 +4419,8 @@ export class AdapterClass extends EventEmitter {
44194419

44204420
try {
44214421
this._utils.validateId(id, true, null);
4422-
} catch (err) {
4423-
return tools.maybeCallbackWithError(callback, err);
4422+
} catch (e) {
4423+
return tools.maybeCallbackWithError(callback, e);
44244424
}
44254425

44264426
this.#objects.findObject(id, type, options || {}, callback);
@@ -4468,8 +4468,8 @@ export class AdapterClass extends EventEmitter {
44684468

44694469
try {
44704470
this._utils.validateId(id, true, options);
4471-
} catch (err) {
4472-
return tools.maybeCallbackWithError(callback, err);
4471+
} catch (e) {
4472+
return tools.maybeCallbackWithError(callback, e);
44734473
}
44744474

44754475
return this._getForeignObject({ id, options, callback });
@@ -4605,8 +4605,8 @@ export class AdapterClass extends EventEmitter {
46054605

46064606
try {
46074607
this._utils.validateId(id, true, options);
4608-
} catch (err) {
4609-
return tools.maybeCallbackWithError(callback, err);
4608+
} catch (e) {
4609+
return tools.maybeCallbackWithError(callback, e);
46104610
}
46114611

46124612
if (options !== null && options !== undefined) {
@@ -4653,8 +4653,8 @@ export class AdapterClass extends EventEmitter {
46534653

46544654
try {
46554655
await this.#objects!.delObject(obj._id, options);
4656-
} catch (err) {
4657-
return tools.maybeCallbackWithError(callback, err);
4656+
} catch (e) {
4657+
return tools.maybeCallbackWithError(callback, e);
46584658
}
46594659
if (obj.type === 'state') {
46604660
try {
@@ -4944,8 +4944,8 @@ export class AdapterClass extends EventEmitter {
49444944

49454945
try {
49464946
this._utils.validateId(id, false, null);
4947-
} catch (err) {
4948-
return tools.maybeCallbackWithError(callback, err);
4947+
} catch (e) {
4948+
return tools.maybeCallbackWithError(callback, e);
49494949
}
49504950

49514951
return this._setObjectNotExists({
@@ -5064,11 +5064,11 @@ export class AdapterClass extends EventEmitter {
50645064

50655065
try {
50665066
this._utils.validateId(id, true, null);
5067-
} catch (err) {
5068-
return tools.maybeCallbackWithError(callback, err);
5067+
} catch (e) {
5068+
return tools.maybeCallbackWithError(callback, e);
50695069
}
50705070

5071-
// check if object exists
5071+
// check if the object exists
50725072
let objExists;
50735073
try {
50745074
objExists = await this.#objects.objectExists(id, options || {});
@@ -7736,8 +7736,8 @@ export class AdapterClass extends EventEmitter {
77367736

77377737
try {
77387738
this._utils.validateId(id, false, null);
7739-
} catch (err) {
7740-
return tools.maybeCallbackWithError(callback, err);
7739+
} catch (e) {
7740+
return tools.maybeCallbackWithError(callback, e);
77417741
}
77427742

77437743
const fixedId = this._utils.fixId(id, false);
@@ -8364,8 +8364,8 @@ export class AdapterClass extends EventEmitter {
83648364

83658365
try {
83668366
this._utils.validateId(id, false, null);
8367-
} catch (err) {
8368-
return tools.maybeCallbackWithError(callback, err);
8367+
} catch (e) {
8368+
return tools.maybeCallbackWithError(callback, e);
83698369
}
83708370

83718371
const fixedId = this._utils.fixId(id, false);
@@ -8506,8 +8506,8 @@ export class AdapterClass extends EventEmitter {
85068506

85078507
try {
85088508
this._utils.validateId(id, true, null);
8509-
} catch (err) {
8510-
return tools.maybeCallbackWithError(callback, err);
8509+
} catch (e) {
8510+
return tools.maybeCallbackWithError(callback, e);
85118511
}
85128512

85138513
if (tools.isObject(state)) {
@@ -8818,8 +8818,8 @@ export class AdapterClass extends EventEmitter {
88188818

88198819
try {
88208820
this._utils.validateId(id, true, null);
8821-
} catch (err) {
8822-
return tools.maybeCallbackWithError(callback, err);
8821+
} catch (e) {
8822+
return tools.maybeCallbackWithError(callback, e);
88238823
}
88248824

88258825
if (tools.isObject(state)) {
@@ -9118,7 +9118,7 @@ export class AdapterClass extends EventEmitter {
91189118
* - average - Same as max, but take average value.
91199119
* - total - Same as max, but calculate total value.
91209120
* - count - Same as max, but calculate number of values (nulls will be calculated).
9121-
* - none - No aggregation at all. Only raw values in given period.
9121+
* - none - No aggregation at all. Only raw values in the given period.
91229122
*
91239123
* @param id object ID of the state.
91249124
* @param options see function description
@@ -9153,9 +9153,9 @@ export class AdapterClass extends EventEmitter {
91539153

91549154
try {
91559155
this._utils.validateId(id, true, null);
9156-
} catch (err) {
9156+
} catch (e) {
91579157
// @ts-expect-error
9158-
return tools.maybeCallbackWithError(callback, err);
9158+
return tools.maybeCallbackWithError(callback, e);
91599159
}
91609160

91619161
options = options || {};
@@ -9257,8 +9257,8 @@ export class AdapterClass extends EventEmitter {
92579257

92589258
try {
92599259
this._utils.validateId(id, false, null);
9260-
} catch (err) {
9261-
return tools.maybeCallbackWithError(callback, err);
9260+
} catch (e) {
9261+
return tools.maybeCallbackWithError(callback, e);
92629262
}
92639263

92649264
// delState does the same as delForeignState, but fixes the ID first
@@ -9311,8 +9311,8 @@ export class AdapterClass extends EventEmitter {
93119311

93129312
try {
93139313
this._utils.validateId(id, true, options);
9314-
} catch (err) {
9315-
return tools.maybeCallbackWithError(callback, err);
9314+
} catch (e) {
9315+
return tools.maybeCallbackWithError(callback, e);
93169316
}
93179317

93189318
if (options?.user && options.user !== SYSTEM_ADMIN_USER) {
@@ -10293,9 +10293,9 @@ export class AdapterClass extends EventEmitter {
1029310293
licenses.push({ ...license, decoded });
1029410294
}
1029510295
}
10296-
} catch (err) {
10296+
} catch (e) {
1029710297
this._logger.error(
10298-
`${this.namespaceLog} Cannot decode license "${license.product}": ${err.message}`
10298+
`${this.namespaceLog} Cannot decode license "${license.product}": ${e.message}`
1029910299
);
1030010300
}
1030110301
}
@@ -10426,8 +10426,8 @@ export class AdapterClass extends EventEmitter {
1042610426
from: id,
1042710427
expire: reportStatusExpirySec
1042810428
});
10429-
} catch (err) {
10430-
this._logger.warn(`${this.namespaceLog} Could not query used process memory: ${err.message}`);
10429+
} catch (e) {
10430+
this._logger.warn(`${this.namespaceLog} Could not query used process memory: ${e.message}`);
1043110431
}
1043210432
this.outputCount += 3;
1043310433
if (this.eventLoopLags.length) {
@@ -11759,8 +11759,8 @@ export class AdapterClass extends EventEmitter {
1175911759
updateAliveState: false
1176011760
});
1176111761
setTimeout(() => this.terminate(EXIT_CODES.UNCAUGHT_EXCEPTION), 1_000);
11762-
} catch (err) {
11763-
this._logger.error(`${this.namespaceLog} exception by stop: ${err ? err.message : err}`);
11762+
} catch (e) {
11763+
this._logger.error(`${this.namespaceLog} exception by stop: ${e ? e.message : e}`);
1176411764
}
1176511765
}
1176611766

@@ -12041,8 +12041,8 @@ export class AdapterClass extends EventEmitter {
1204112041
if (this._config.states && this._config.states.type) {
1204212042
try {
1204312043
this.States = (await import(`@iobroker/db-states-${this._config.states.type}`)).Client;
12044-
} catch (err) {
12045-
throw new Error(`Unknown states type: ${this._config.states.type}: ${err.message}`);
12044+
} catch (e) {
12045+
throw new Error(`Unknown states type: ${this._config.states.type}: ${e.message}`);
1204612046
}
1204712047
} else {
1204812048
this.States = await getStatesConstructor();
@@ -12051,8 +12051,8 @@ export class AdapterClass extends EventEmitter {
1205112051
if (this._config.objects && this._config.objects.type) {
1205212052
try {
1205312053
this.Objects = (await import(`@iobroker/db-objects-${this._config.objects.type}`)).Client;
12054-
} catch (err) {
12055-
throw new Error(`Unknown objects type: ${this._config.objects.type}: ${err.message}`);
12054+
} catch (e) {
12055+
throw new Error(`Unknown objects type: ${this._config.objects.type}: ${e.message}`);
1205612056
}
1205712057
} else {
1205812058
this.Objects = await getObjectsConstructor();

0 commit comments

Comments
 (0)