wakepy icon indicating copy to clipboard operation
wakepy copied to clipboard

Make `on_fail="warn"` the default?

Open fohrloop opened this issue 6 months ago • 0 comments

While I've previously said that the default on_fail="error" for the wakepy modes (keep.presenting / keep.running) comes from zen of python:

Errors should never pass silently. Unless explicitly silenced.

it seems that it causes more harm than good. I've seen a few cases where wakepy is misunderstood to be "not working" or "causing errors" or "being flaky" just because the default on_fail action is "error". It should be also noted that the zen of python also says that practicality beats purity, and issuing a warning would probably be enough of a message (a warning is not same as being silent).

Option 1: on_fail defaults to "error"

  • Pro: Any user testing if wakepy works on a specific system gets immediate feedback if it does not; an exception is raised.
  • Con: Typical use case: Someone uses wakepy in a multiplatform application. He/she tests it on their system and perhaps some other systems. Then, someone runs the same app on some another system which is not yet supported, and the app crashes, because the default behavior is on_fail="error". The user probably opens an Issue to the application repository, and then the maintainer either sees what's wrong and fixes the on_fail action to be something else, or just removes wakepy from the app, either from everyone or from the platform.

Option 2: on_fail defaults to "warn"

  • Con?: Any user testing if wakepy works on a specific systems gets immediate feedback if it does not, but the feedback is printed in console, and does not crash the app/script.
  • Pro: The typical use case in "Option 1" does not have any issues (just a warning printed in the worst case).

For the above mentioned reasons I kind of think that the "warn" default makes bit more sense.

fohrloop avatar Aug 13 '24 19:08 fohrloop