← Back to team overview

python-quantities-developers team mailing list archive

Re: should we have a UnitsError?

 

On Mon, Jan 19, 2009 at 6:26 PM, John Salvatier
<jsalvati@xxxxxxxxxxxxxxxx>wrote:

> Do you think we should have a subclass of ValueError called UnitsError? I
> find myself frequently checking to see if the units will work out for
> something within a function and then returning a ValueError if they don't,
> so it seems like we could standardize with a UnitsError class.
>

I prefer the ValueError, I think it is appropriate for this use case.
ValueError is meant to be used for "Inappropriate argument value (of correct
type)". What is wrong with standardizing with the builtin ValueError? I'd
prefer not to burden users with having to import special exceptions, numpy
doesnt use them either as far as I know.

References