Closed BenniG82 closed 2 years ago
Hi BenniG82,
thanks for your contribution.
Sadly I cannot merge it in the current state. The resol-vbus library assumes that the "serialport" dependency is optional since some of the environments this library is used in do not support it.
Your patch would make it a non-optional dependency because the calling process would terminate if the dependency is not loadable, regardless of whether it is actually used or not.
But I really like the intention you are pursuing here. I have sketched a different approach on this branch: https://github.com/danielwippermann/resol-vbus/tree/feature/improved-serialport-error
The error reporting would be delayed until the serial port is actually used. On systems that do not even try to use it, the behaviour would be exactly like before, not triggering any error / termination.
Please have a look at that solution and try whether that would suit your need as well. If so I'll merge it into the master branch.
And would it be okay for you if I add you to the list of contributors?
Thanks again, Daniel
Hi Daniel,
thanks for your response. My bad, I only had my use-case in mind. I saw your solution and tried if we can reduce the "footprint" a little more. I pushed a new commit which "lazily" requires serialport. If you don't like it, I'm perfectly fine with your solution :)
Thanks and best regards Benjamin
Merged with commit 80e3a4f9d443c9951a02c3054dab785a0d571e20.
With this little fix you can provide some worthy information to the user.
Error without the fix:
What does this mean?!
Error with the fix:
Yep, that sounds like something I can fix :)