#32251: GEOSGeometry error logging when handling a GEOSException
-------------------------------------+-------------------------------------
               Reporter:  Richard    |          Owner:  nobody
  Boon                               |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  GIS        |        Version:  3.1
               Severity:  Normal     |       Keywords:  GEOSGeometry
           Triage Stage:             |  GEOSException logger
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When instantiating an invalid GEOSGeometry and catching the GEOSException,
 the logger still logs a GEOSException. I would expect no error logging
 when catching and handling the exception.
 For example:

 {{{
 from django.contrib.gis.geos import GEOSGeometry, GEOSException
 import logging

 logger = logging.getLogger()
 logger.setLevel(logging.DEBUG)

 try:
     GEOSGeometry("POLYGON ((20 30, 35 35, 30 20))")
 except GEOSException:
     pass
 }}}

 This will display the following error message:

 `2020-12-09 10:03 ERROR GEOS_ERROR: IllegalArgumentException: Points of
 LinearRing do not form a closed linestring`

 It seems that the logging happens here:
 
https://github.com/django/django/blob/2c5d6dc44779448de1497f32c925c96975fae461/django/contrib/gis/geos/libgeos.py#L99

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32251>
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/052.14224da8484d20f8921d8e02e570b314%40djangoproject.com.

Reply via email to