fohrloop/wakepy

Method.caniuse: Many ways to indicate failing caniuse check

Opened this issue · 0 comments

Currently, when subclassing Method, if the caniuse() check fails, the subclass could either.

  • Return False (means unsuitable) or a string (means unsuitable and tell a reason for it)
  • Raise an Exception

Should there be only one way to indicate that the caniuse check fails? Perhaps, change the wording from

        Returns
        -------
        result: bool | None | str
            ``True`` means suitable, ``None`` means uncertain, ``False`` means
            unsuitable and  a string means unsuitable and tells the reason for
            it.

        Raises
        ------
        Exception
            If the Method may not be used, may raise an Exception.

to

        Returns
        -------
        result: bool | None | str
            ``True`` means suitable, ``None`` means uncertain, ``False`` means
            unsuitable and  a string means unsuitable and tells the reason for
            it.

        any exception raised is interpreted as a failed caniuse check, but when subclassing, it is preferable to use a return value rather than raise an exception.