Skip to content

Commit ef3265a

Browse files
If no configuration found, or adapter was not properly installed, check it. (#2418)
* If no configuration found, or adapter was not properly installed, check it. * do not crash hard if plugins could not be added --------- Co-authored-by: Max Hauser <[email protected]>
1 parent dfd2da5 commit ef3265a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11885,7 +11885,7 @@ export class AdapterClass extends EventEmitter {
1188511885
// give it a chance to handle the error itself instead of restarting it
1188611886
if (typeof this._options.error === 'function') {
1188711887
try {
11888-
// if error handler in the adapter returned exactly true,
11888+
// if the error handler in the adapter returned exactly true,
1188911889
// we expect the error to be handled and do nothing more
1189011890
const wasHandled = this._options.error(err);
1189111891
if (wasHandled === true) {
@@ -12178,8 +12178,11 @@ export class AdapterClass extends EventEmitter {
1217812178
};
1217912179

1218012180
this.pluginHandler = new PluginHandler(pluginSettings);
12181-
this.pluginHandler.addPlugins(this.ioPack.common.plugins, [this.adapterDir, __dirname]); // first resolve from adapter directory, else from js-controller
12182-
12181+
try {
12182+
this.pluginHandler.addPlugins(this.ioPack.common.plugins, [this.adapterDir, __dirname]); // first resolve from adapter directory, else from js-controller
12183+
} catch (e) {
12184+
this._logger.error(`Could not add plugins: ${e.message}`);
12185+
}
1218312186
// finally init
1218412187
_initDBs();
1218512188
}

packages/common/src/lib/common/tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ export async function sendDiagInfo(obj: Record<string, any>): Promise<void> {
15251525
*/
15261526
export function getAdapterDir(adapter: string): string | null {
15271527
// snip off 'iobroker.'
1528-
if (adapter.toLowerCase().startsWith(appName.toLowerCase() + '.')) {
1528+
if (adapter.toLowerCase().startsWith(`${appNameLowerCase}.`)) {
15291529
adapter = adapter.substring(appName.length + 1);
15301530
}
15311531
// snip off instance id

0 commit comments

Comments
 (0)