Skip to content

Commit

Permalink
[FIX] base_geolocalize: update log when request to openstreetmap fails
Browse files Browse the repository at this point in the history
When the user will not get an HTTP response as 200 while retrieving the location
using OpenStreetMap Nominatim service, the logger error will occur.

The logger is updated to use the 'warning' level instead of the 'error' level.
This change reflects a less severe logging level for cases where a request to
OpenStreetMap fails.

sentry-4151622143

closes odoo#125785

X-original-commit: a73a65e
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
  • Loading branch information
sauc-odoo committed Jun 21, 2023
1 parent 74d058e commit 1f4395e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/base_geolocalize/models/base_geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _call_openstreetmap(self, addr, **kw):
response = requests.get(url, headers=headers, params={'format': 'json', 'q': addr})
_logger.info('openstreetmap nominatim service called')
if response.status_code != 200:
_logger.error('Request to openstreetmap failed.\nCode: %s\nContent: %s' % (response.status_code, response.content))
_logger.warning('Request to openstreetmap failed.\nCode: %s\nContent: %s', response.status_code, response.content)
result = response.json()
except Exception as e:
self._raise_query_error(e)
Expand Down

0 comments on commit 1f4395e

Please sign in to comment.