Improve user choice in handling exceptions with more handlers #1618
Labels
design discussion
Ways to improve OSHI's design
new feature
Something OSHI doesn't do now but could do
PR welcome
Not maintainer's priority to do but will accept contributions!
up for grabs
Issues the maintainers want community help with
We've had lengthy discussions on handling exception behavior, for example this discussion: oshi/oshi6#2 also related to requests by @rnaval in #1341 and @joshiste in #1589.
I've deferred most of these conversations to the possibility that in some future version we may completely change the API introducing
Optional
or wrapper objects with more info, but the longer we go the less I think that's a good direction. I do think there's something we can do within the current API, however and that's to expand the usage of designed-for-extension handler objects.For example, the
WmiQueryHandler
class is designed for users to be able to override some behavior (e.g., COM initialization if they have done so in their own app). It also includes ahandleComException()
method called from within a catch block that by default logs (at WARN level) the exception, but a user could change that behavior if they chose; perhaps a different level of logging, or re-throwing the exception.I'd like the community's help in identifying good candidates (like #1589) to to add handlers for, as well as suggestions/ideas on best practices so we do it right the first time.
The text was updated successfully, but these errors were encountered: