Skip to content

[refactoring]: Just rename all catch (err) to catch (e) according to code style guide #2888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions packages/adapter/src/lib/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@
* ...
* }
* ```

Check warning on line 1608 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Expected JSDoc block to be aligned
* @param featureName the name of the feature to check
* @returns true/false if the feature is in the list of supported features
*/
Expand Down Expand Up @@ -2846,8 +2846,8 @@
if (options.obj.type !== 'meta') {
try {
this._utils.validateId(options.id, false, null);
} catch (err) {
this._logger.error(tools.appendStackTrace(`${this.namespaceLog} ${err.message}`));
} catch (e) {
this._logger.error(tools.appendStackTrace(`${this.namespaceLog} ${e.message}`));
return;
}
}
Expand Down Expand Up @@ -3478,8 +3478,8 @@

try {
this._utils.validateId(id, true, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

Validator.assertString(id, 'id');
Expand Down Expand Up @@ -3725,8 +3725,8 @@

try {
this._utils.validateId(id, false, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

this.#objects.getObject(this._utils.fixId(id), options, callback);
Expand Down Expand Up @@ -4419,8 +4419,8 @@

try {
this._utils.validateId(id, true, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

this.#objects.findObject(id, type, options || {}, callback);
Expand Down Expand Up @@ -4468,8 +4468,8 @@

try {
this._utils.validateId(id, true, options);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

return this._getForeignObject({ id, options, callback });
Expand Down Expand Up @@ -4605,8 +4605,8 @@

try {
this._utils.validateId(id, true, options);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

if (options !== null && options !== undefined) {
Expand Down Expand Up @@ -4653,8 +4653,8 @@

try {
await this.#objects!.delObject(obj._id, options);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}
if (obj.type === 'state') {
try {
Expand Down Expand Up @@ -4944,8 +4944,8 @@

try {
this._utils.validateId(id, false, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

return this._setObjectNotExists({
Expand Down Expand Up @@ -5064,11 +5064,11 @@

try {
this._utils.validateId(id, true, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

// check if object exists
// check if the object exists
let objExists;
try {
objExists = await this.#objects.objectExists(id, options || {});
Expand Down Expand Up @@ -5138,11 +5138,11 @@
): void;

/**
* @param deviceName

Check warning on line 5141 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "deviceName" description
* @param common

Check warning on line 5142 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "common" description
* @param _native

Check warning on line 5143 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "_native" description
* @param options

Check warning on line 5144 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "options" description
* @param callback

Check warning on line 5145 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "callback" description
* @deprecated use `this.extendObject` instead
*/
createDevice(deviceName: unknown, common: unknown, _native?: unknown, options?: unknown, callback?: unknown): any {
Expand Down Expand Up @@ -5233,10 +5233,10 @@
/**
* Name of channel must be in format "channel"
*
* @param parentDevice

Check warning on line 5236 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "parentDevice" description
* @param channelName

Check warning on line 5237 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "channelName" description
* @param roleOrCommon

Check warning on line 5238 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "roleOrCommon" description
* @param _native

Check warning on line 5239 in packages/adapter/src/lib/adapter/adapter.ts

View workflow job for this annotation

GitHub Actions / Eslint

Missing JSDoc @param "_native" description
* @param options
* @param callback
* @deprecated use `this.extendObject` instead
Expand Down Expand Up @@ -7736,8 +7736,8 @@

try {
this._utils.validateId(id, false, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

const fixedId = this._utils.fixId(id, false);
Expand Down Expand Up @@ -8364,8 +8364,8 @@

try {
this._utils.validateId(id, false, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

const fixedId = this._utils.fixId(id, false);
Expand Down Expand Up @@ -8506,8 +8506,8 @@

try {
this._utils.validateId(id, true, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

if (tools.isObject(state)) {
Expand Down Expand Up @@ -8818,8 +8818,8 @@

try {
this._utils.validateId(id, true, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

if (tools.isObject(state)) {
Expand Down Expand Up @@ -9118,7 +9118,7 @@
* - average - Same as max, but take average value.
* - total - Same as max, but calculate total value.
* - count - Same as max, but calculate number of values (nulls will be calculated).
* - none - No aggregation at all. Only raw values in given period.
* - none - No aggregation at all. Only raw values in the given period.
*
* @param id object ID of the state.
* @param options see function description
Expand Down Expand Up @@ -9153,9 +9153,9 @@

try {
this._utils.validateId(id, true, null);
} catch (err) {
} catch (e) {
// @ts-expect-error
return tools.maybeCallbackWithError(callback, err);
return tools.maybeCallbackWithError(callback, e);
}

options = options || {};
Expand Down Expand Up @@ -9257,8 +9257,8 @@

try {
this._utils.validateId(id, false, null);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

// delState does the same as delForeignState, but fixes the ID first
Expand Down Expand Up @@ -9311,8 +9311,8 @@

try {
this._utils.validateId(id, true, options);
} catch (err) {
return tools.maybeCallbackWithError(callback, err);
} catch (e) {
return tools.maybeCallbackWithError(callback, e);
}

if (options?.user && options.user !== SYSTEM_ADMIN_USER) {
Expand Down Expand Up @@ -10293,9 +10293,9 @@
licenses.push({ ...license, decoded });
}
}
} catch (err) {
} catch (e) {
this._logger.error(
`${this.namespaceLog} Cannot decode license "${license.product}": ${err.message}`
`${this.namespaceLog} Cannot decode license "${license.product}": ${e.message}`
);
}
}
Expand Down Expand Up @@ -10426,8 +10426,8 @@
from: id,
expire: reportStatusExpirySec
});
} catch (err) {
this._logger.warn(`${this.namespaceLog} Could not query used process memory: ${err.message}`);
} catch (e) {
this._logger.warn(`${this.namespaceLog} Could not query used process memory: ${e.message}`);
}
this.outputCount += 3;
if (this.eventLoopLags.length) {
Expand Down Expand Up @@ -11759,8 +11759,8 @@
updateAliveState: false
});
setTimeout(() => this.terminate(EXIT_CODES.UNCAUGHT_EXCEPTION), 1_000);
} catch (err) {
this._logger.error(`${this.namespaceLog} exception by stop: ${err ? err.message : err}`);
} catch (e) {
this._logger.error(`${this.namespaceLog} exception by stop: ${e ? e.message : e}`);
}
}

Expand Down Expand Up @@ -12041,8 +12041,8 @@
if (this._config.states && this._config.states.type) {
try {
this.States = (await import(`@iobroker/db-states-${this._config.states.type}`)).Client;
} catch (err) {
throw new Error(`Unknown states type: ${this._config.states.type}: ${err.message}`);
} catch (e) {
throw new Error(`Unknown states type: ${this._config.states.type}: ${e.message}`);
}
} else {
this.States = await getStatesConstructor();
Expand All @@ -12051,8 +12051,8 @@
if (this._config.objects && this._config.objects.type) {
try {
this.Objects = (await import(`@iobroker/db-objects-${this._config.objects.type}`)).Client;
} catch (err) {
throw new Error(`Unknown objects type: ${this._config.objects.type}: ${err.message}`);
} catch (e) {
throw new Error(`Unknown objects type: ${this._config.objects.type}: ${e.message}`);
}
} else {
this.Objects = await getObjectsConstructor();
Expand Down
Loading