cansik / artnet4j

Art-Net DMX over IP library for Java and Processing
GNU General Public License v3.0
94 stars 21 forks source link

Exceptions usually are swallowed #6

Open schw4rzlicht opened 6 years ago

schw4rzlicht commented 6 years ago

The usual behavior of artnet4j is to log Exceptions using Logger instances when they are thrown. This is a design flaw imo since Exceptions are a good thing for devs who use the lib because they can catch them to recover from errors or at least notify the user.

In my use case, I let the user decide on which network interface they want to send Art-Net. When it's not possible to use the chosen interface for whatever reason, I'm not even able to tell this to the user in any way (not a console app). So the UI looks like everything is working but no packets are being sent.

I'd propose to at least being able to disable logging and re-throw Exceptions using flags/environment variables or to resign from logging all together - in favor of catchable Exceptions.

cansik commented 6 years ago

Yep, I see it the same way as you do. I think the best thing is to gather all this refactoring ideas and then rewrite the library from scratch. Because there are a lot of architectural things I would like to change, which also includes error handling.

schw4rzlicht commented 6 years ago

Sounds good. Do you already have a timeline for that? I need a quick solution for my current project since it needs to be ready for this summers' festivals. However, it wont be a problem to find a fix for this issue (and my current project) by myself if you mind changing the current library and then participate on the new library if you'd like.

cansik commented 6 years ago

No I do not have a timeline for that at the moment. I can understand that you need it for your project as quick as possible, but my master thesis needs a bit of attention too ;)

Maybe I can propose a new library architecture this weekend, but I think the development process won't be that fast as you need it.

schw4rzlicht commented 6 years ago

Like I said, no worries :) Take your time and I am happy to participate when you find the time.

schw4rzlicht commented 6 years ago

Hey @cansik I started to build a new library from scratch. You can find it here. Every contribution would be great, maybe this is also a good place to merge existing stuff?

cansik commented 4 years ago

@schw4rzlicht Looks great! I just missed this notification :) I will try it out later 🙌🏻

schw4rzlicht commented 4 years ago

Let me know when you had the time to check it out and let me know what you think :)