#35681: GeoIP2Exception does not work as advertised
------------------------------+------------------------------------
     Reporter:  Jon Ribbens   |                    Owner:  (none)
         Type:  Bug           |                   Status:  new
    Component:  GIS           |                  Version:  5.1
     Severity:  Normal        |               Resolution:
     Keywords:  geoip geoip2  |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  1             |                    UI/UX:  0
------------------------------+------------------------------------
Comment (by David Guillot):

 Hi there,

 Wow, I just wanted to make a contribution to an easy-pick issue, and here
 I am, thinking about this deep discussion for 20 minutes :-D. What's the
 way to go on such situation?

 My two cents:
 - This issue is very legitimate, because the code behavior differs from
 the docs, and that can be confusing to users.
 - On one hand, I would not say that this module is a "very thin wrapper":
 it hides the implementation, and it does not even give access to the
 underlying geoip2 response objects for the users to handle them by
 themselves. Wrapping the library errors is the only thing that's missing.
 - On the other hand, Django probably should not wrap third-party
 exceptions, and users of this particular module do know that they're using
 geoip2 under the hood, since they have to add it to their dependencies.
 - In the end I would go for a compromise that would technically "break the
 encapsulation" but would leverage the users knowledge to mitigate the
 risk:
   - Change the docs to tell that GeoIP2Exception helps tracking
 configuration/usage exceptions
   - Add to the docs that geoip2 library exceptions would have to be
 handled by the user
   - Add `raises` statements to the docstring of all wrappers public
 methods that can raise exceptions from the geoip2 library

 What do you think?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35681#comment:7>
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/01070191bcbb68f8-652b9f3f-0de9-4c27-a717-cd49758267e5-000000%40eu-central-1.amazonses.com.

Reply via email to