Skip to content

Commit

Permalink
If no configuration found, or adapter was not properly installed, che…
Browse files Browse the repository at this point in the history
…ck 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]>
  • Loading branch information
GermanBluefox and foxriver76 authored Sep 20, 2023
1 parent dfd2da5 commit ef3265a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/adapter/src/lib/adapter/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11885,7 +11885,7 @@ export class AdapterClass extends EventEmitter {
// give it a chance to handle the error itself instead of restarting it
if (typeof this._options.error === 'function') {
try {
// if error handler in the adapter returned exactly true,
// if the error handler in the adapter returned exactly true,
// we expect the error to be handled and do nothing more
const wasHandled = this._options.error(err);
if (wasHandled === true) {
Expand Down Expand Up @@ -12178,8 +12178,11 @@ export class AdapterClass extends EventEmitter {
};

this.pluginHandler = new PluginHandler(pluginSettings);
this.pluginHandler.addPlugins(this.ioPack.common.plugins, [this.adapterDir, __dirname]); // first resolve from adapter directory, else from js-controller

try {
this.pluginHandler.addPlugins(this.ioPack.common.plugins, [this.adapterDir, __dirname]); // first resolve from adapter directory, else from js-controller
} catch (e) {
this._logger.error(`Could not add plugins: ${e.message}`);
}
// finally init
_initDBs();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/lib/common/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ export async function sendDiagInfo(obj: Record<string, any>): Promise<void> {
*/
export function getAdapterDir(adapter: string): string | null {
// snip off 'iobroker.'
if (adapter.toLowerCase().startsWith(appName.toLowerCase() + '.')) {
if (adapter.toLowerCase().startsWith(`${appNameLowerCase}.`)) {
adapter = adapter.substring(appName.length + 1);
}
// snip off instance id
Expand Down

0 comments on commit ef3265a

Please sign in to comment.