-
Notifications
You must be signed in to change notification settings - Fork 42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave both please
@grizz what problem are you trying to fix more specifically? Can you provide an example? E.g.: if the connection is rejected due to unknown host, we would only see that |
@mirceaulinic If you're not abstracting the exceptions, it makes it very hard to use as a library. For example, if the eznc exception is propagated up the stack, my generic program at the top has to know that it's an eznc object and/or deal with each type of network driver separately. |
@grizz this is not the answer I am looking for. Why not then: try:
except Exception and avoid propagating any errors. Can you give an example of the error you encountered and broke your app? And here I refer to errors that may occur by non-deterministic causes: e.g. |
@mirceaulinic You could just raise What does it matter whether or not it's deterministic matter for exception type? In https://github.com/20c/ngage/tree/master/ngage/plugins I have plugins for both eznc and now napalm, in eznc I catch |
Maybe this should be closed and discussed in an issue on a broader scope? |
I was sarcastic on this :)
As previously said, exceptions such as On the other hand, if you restrict your visibility to |
Was wondering, either way, it's virtually the same from a program's perspective :)
It's a command line tool, so that wouldn't be true in my case.
Ideally, you'd have exception wrappers for each driver that conveyed all of the information in a standard and more granular way. Without that, at least with this I can tell if it's happened during connection, try a password, and then throw if not. Without an exception abstraction, how would you propose I handle any exception thrown from open()? Just give up and stack trace? |
That would make sense - we should indeed have more granular exceptions. Feel free to open an issue for discussion under napalm-base or even come with a PR with new Exception classes. |
My two cents on this, we should certainly catch "transport library" specific exceptions and throw our owns. Otherwise, as @grizz mentioned it's a nightmare from a napalm user perspective. To avoid losing information:
|
Totally agree, let's do that! |
Closing this as better exceptions will be tracked under napalm-automation/napalm-base#218. @grizz if you are able to give a helping hand with this, it would be much appreciated! Thanks! |
No description provided.