Skip to content
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

"uncaught exception: Cannot convert undefined or null to object" at fronius restart #313

Closed
mcm1957 opened this issue Jun 7, 2023 · 3 comments

Comments

@mcm1957
Copy link
Member

mcm1957 commented Jun 7, 2023

Adapter crashes at restart of fronius system:

2023-06-06 08:55:12.079 - error: fronius.0 (26028) uncaught exception: Cannot convert undefined or null to object
2023-06-06 08:55:12.079 - error: fronius.0 (26028) TypeError: Cannot convert undefined or null to object
  | at hasOwnProperty ()
  | at createStates (/opt/iobroker/node_modules/iobroker.fronius/lib/devObjects.js:474:41)
  | at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.fronius/lib/devObjects.js:127:17)
  | at listOnTimeout (node:internal/timers:561:11)
  | at processTimers (node:internal/timers:502:7)

An exception stating problems would be OK, a crash must be avoided.

Detail log see comments at forum:

@mcm1957 mcm1957 added the bug label Jun 7, 2023
@mcm1957 mcm1957 added this to the Release 2.0.x-fixes milestone Jun 7, 2023
@nkleber78
Copy link
Collaborator

nkleber78 commented Jun 7, 2023

There i need to think how to handle cases where somewhere in the middle of the process the object is not delivering the expected values. @mcm1957 do you think we should issue an error log or just a warning log for such catched errors?

@mcm1957
Copy link
Member Author

mcm1957 commented Jun 7, 2023

Depends on the situation:

If this is a situation which can occure in normal operation, neither warning nur error is needed. In most cases even no try/catch will be necessary then but a normal if (obj && obj.element ...) or even ... obj?.element... code sequence will do it and either some action will be skipped or processed with a default value.

If the situation is really unexpected (i.e. the fronius reports the voltage of 2 phases but the third phase is missing in response) logging a warning should be ok. This would allow the user to (tempory) change logging to error if the warnings are too often while the overall operation is still ok.

If the adapter need to terminate / restart / drop the connection and reinitialize itself or cannot do any useful operation an erro will be OK.

There i need to think how to handle cases where somewhere in the middle of the process the object is not delivering the expected values.

If you have the situation where the system sends an answerblock but some data is missing you could evaluate whether ist acceptable to simple set the states to null (and optionally set a siutable q flag) indicating "well - fronius did not send currentz power value ...")

nkleber78 added a commit to nkleber78/ioBroker.fronius that referenced this issue Jun 8, 2023
@nkleber78
Copy link
Collaborator

Part of Release 2.0.2

@nkleber78 nkleber78 removed their assignment Jun 28, 2023
mcm1957 added a commit that referenced this issue Jun 28, 2023
-   (nkleber78) Instability issues fixed. (#306, #313)
-   (nkleber78) Set values for parameters delivered as 'null' from API to 0. (#315)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants