From 5071a7cc207250c62b7cdbcd2b0e81adfeed3d42 Mon Sep 17 00:00:00 2001 From: mortenwh Date: Wed, 10 Jul 2019 23:10:57 +0200 Subject: [PATCH] #30: treat different errors correctly --- geospaas_wind/managers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/geospaas_wind/managers.py b/geospaas_wind/managers.py index a0a5b9c..91d1dec 100644 --- a/geospaas_wind/managers.py +++ b/geospaas_wind/managers.py @@ -34,12 +34,11 @@ def process(self, uri, force=False, *args, **kwargs): try: w = wind_from_sar_and_arome_forecast(uri) except (TooHighResolutionError, PolarizationError, ObjectDoesNotExist) as e: - try: + if type(e)==Dataset.DoesNotExist: + warnings.warn(uri+': '+e.args[0]) + else: + # ObjectDoesNotExist could happen if there is no overlap between SAR and model warnings.warn(e.file + ': ' + e.msg) - except AttributeError: - import ipdb - ipdb.set_trace() - warnings.warn(e) return None, False metadata = w.get_metadata()