screeninfo
screeninfo copied to clipboard
Report more specific error messages
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
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.
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.