ioBroker.js-controller icon indicating copy to clipboard operation
ioBroker.js-controller copied to clipboard

Split global dependency error messages to distinguish missing adapters from version mismatches

Open Copilot opened this issue 4 months ago • 10 comments

The error message for global adapter dependencies was confusing and not actionable for users, especially when adapters were completely missing versus having version mismatches. The controller would show the same generic message for both scenarios:

Adapter dependency not fulfilled on any host: required adapter "admin" has wrong version...

This change implements distinct error handling to provide specific, actionable messages based on the actual problem:

Enhanced Error Handling

For missing adapters:

Adapter dependency not fulfilled: required adapter "admin" not found!

For version mismatches:

Adapter dependency not fulfilled on all hosts where adapter is installed: required adapter "admin" has wrong version. Installed "7.2.6", required ">=7.4.10"!

Implementation Details

  • Custom Error Classes: Added AdapterNotFoundError and AdapterVersionMismatchError to distinguish between different failure types
  • Enhanced checkVersion Function: Updated to throw appropriate error types based on the specific dependency issue
  • Smart Error Message Selection: Global dependency handler now provides context-specific messages based on the error type

Example Scenarios

Missing Adapter

When an adapter dependency is not installed at all:

startInstance system.adapter.kecontact.0 Adapter dependency not fulfilled: required adapter "admin" not found!

Version Mismatch in Multihost

An adapter requires admin >= 7.4.10 as a global dependency, but the system has admin 7.2.6 on a slave host:

startInstance system.adapter.kecontact.0 Adapter dependency not fulfilled on all hosts where adapter is installed: required adapter "admin" has wrong version. Installed "7.2.6", required ">=7.4.10"!

Benefits

  • Clear Problem Identification: Users immediately know if they need to install a missing adapter or update an existing one
  • Actionable Guidance: Each message points to the specific action required
  • Multihost Clarity: Version mismatch messages clearly indicate the need to check all hosts
  • Eliminates Confusion: No more ambiguous messages when adapters are completely missing

The implementation uses surgical changes with custom error classes to maintain backward compatibility while providing much clearer user guidance.

Fixes #3037.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Aug 31 '25 12:08 Copilot

lgtm

mcm1957 avatar Aug 31 '25 18:08 mcm1957

I still find this message confusing, if the dependency eg ist not installed at all

foxriver76 avatar Aug 31 '25 18:08 foxriver76

The message will not be displayed if the adapter is not installed at all at a slave.

mcm1957 avatar Aug 31 '25 19:08 mcm1957

Will be displayed whenever global dep ist not fulfilled, could be not installed at all but could also be wrong version on some host..

foxriver76 avatar Aug 31 '25 19:08 foxriver76

This message will not be displayed if i.e. admin 7.0.0 is required,admin 7.x.x is installed on master buet admin is NOT installed on slave.

Message will be displayed if admin 7.x.x is installed on master and admin 6.x.x is installed on slave.

This behavior is desired and ok.

Onle the current message that admin dependency is not fullfilled on ANY host is wrong. In the second example dependency is fullfuöled on ANY host (master) but not on ALL host ( the slave)

mcm1957 avatar Sep 01 '25 09:09 mcm1957

And it is displayed if no admin is installed at all and then it becomes a weird message

foxriver76 avatar Sep 01 '25 09:09 foxriver76

OK - I see Any better texting suggestion?

Maybe we need two diffrent messages

  • one if the adapter (admin) is not installed at all on any host
  • and a second if admin ist installed but with an incorrect version

mcm1957 avatar Sep 01 '25 15:09 mcm1957

Alright then lets split the error message variants

@copilot The error message is still confusing in the case that the global dependency is missing at all. Please adjust checkVersion to throw different error instance types (create them) for not found and version-mismatch cases and then ensure that the two cases have meaningful error messages

Apollon77 avatar Sep 26 '25 08:09 Apollon77

Alright then lets split the error message variants

@copilot The error message is still confusing in the case that the global dependency is missing at all. Please adjust checkVersion to throw differ...

I've updated the error handling to provide specific error messages for different scenarios. Created separate error classes (AdapterNotFoundError and AdapterVersionMismatchError) that allow the checkVersion function to distinguish between missing adapters and version mismatches.

Now the error messages are:

  • For missing adapters: "Adapter dependency not fulfilled: required adapter 'X' not found!"
  • For version mismatches: "Adapter dependency not fulfilled on all hosts where adapter is installed: required adapter 'X' has wrong version..."

This makes it much clearer for users to understand whether they need to install a missing adapter or update an existing one to meet version requirements.

Commit: 51c56c0

Copilot avatar Sep 26 '25 08:09 Copilot

@foxriver76 Please check again

Apollon77 avatar Sep 27 '25 12:09 Apollon77