Recommended exception method for modules?
Toby Dickenson
mbel44 at dial.pipex.net
Thu Oct 5 12:20:54 EDT 2000
ge at nowhere.none (Grant Edwards) wrote:
> 3) a class for each type of error with value(s) that further
> explain what is wrong:
>
> class PosixSerialBaudError(Exception):
> [...]
>
> if not validBaud(r):
> raise PosixSerialBaudError(r)
>
> [this last one could be done as a subclass of a general
> PosixSerialError class, -- that way somebody can catch
> either all of my exceptions or just individual ones.
> Right?]
Possibly a PosixSerialBaudError is a little too specific. Are you
going to add PosixSerialParityError, PosixSerialTimeoutError, and
PosixSerialOutgoingFlowcontrolError too?
It might be more useful to have more general PosixSerialError (or
possibly PosixSerialSettingsError).
Toby Dickenson
tdickenson at geminidataloggers.com
More information about the Python-list
mailing list