#34676: Add DistanceUnitDoesNotExist exception to contrib.gis.measure
-------------------------------------+-------------------------------------
Reporter: Andrew Northall | Owner: Andrew
Type: | Northall
Cleanup/optimization | Status: assigned
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
Replying to [comment:3 Andrew Northall]:
> Replying to [comment:2 Mariusz Felisiak]:
> > I don't think that separate exception class is justified, I'd change
to the `ValueError`.
>
>
> Thanks - if you'd rather not have a class, would it perhaps be better to
normalise all unit not found exceptions to `AttributeError`?
>
> `default_units()` already returns `AttributeError` if the units are not
found (before I changed it in my PR), so would it be better just to make
`unit_attname()` also return `AttributeError` to match (and hence retain
backwards compatibility with people who may depend on `default_units()`
returning `AttributeError`)?
>
> Or would you leave `default_units()` as `AttributeError` and have
`unit_attname()` return `ValueError`?
We should unify both exceptions. I'd use `AttributeError` as it will be
backward compatible.
--
Ticket URL: <https://code.djangoproject.com/ticket/34676#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070188edde47d2-b23434ac-c580-4fd3-ab61-c25fa7ad11f8-000000%40eu-central-1.amazonses.com.