screeninfo icon indicating copy to clipboard operation
screeninfo copied to clipboard

Report more specific error messages

Open feerrenrut opened this issue 4 years ago • 2 comments

There are many things that may have gone wrong when getting an error such as: screeninfo.common.ScreenInfoError: No enumerators available

Catching errors and re-raising them from within the enumerators will help to identify the cuase of a problem.

Originally posted by @feerrenrut in https://github.com/rr-/screeninfo/issues/27#issuecomment-612372368

feerrenrut avatar Apr 11 '20 14:04 feerrenrut

The reason why they're caught this way is because screeninfo attempts to use the first available enumerator that succeeds. This should be replaced with checking user's environment such as platform.system() etc.

rr- avatar Apr 11 '20 17:04 rr-

Just a suggestion to make debugging eaiser, right now it's a pain. To find out the real error I had to modify the library to actually include the raised exception, even then it wasn't really clear which method in the Windows enumerator had failed, so I had to wrap each of those.

Arguably "no emumerators available" is incorrect, at best misleading. It suggests that the platform isn't supported, or there is no screen rather than an error within one of the enumerators.

feerrenrut avatar Apr 12 '20 14:04 feerrenrut