try:
observations = json['STATION'][0]['OBSERVATIONS']
- except KeyError:
- LOG.error("Unexpected JSON in MesoWest response")
+ except KeyError as exc:
+ LOG.error("Unexpected JSON in MesoWest response: '%s'", exc)
sys.exit(1)
- except ValueError:
- LOG.error("Bad JSON in MesoWest response")
+ except IndexError as exc:
+ LOG.error("Unexpected JSON in MesoWest response: '%s'", exc)
+ try:
+ LOG.error("Detailed MesoWest response: '%s'",
+ json['SUMMARY']['RESPONSE_MESSAGE'])
+ except KeyError:
+ pass
+ sys.exit(1)
+ except ValueError as exc:
+ LOG.error("Bad JSON in MesoWest response: '%s'", exc)
sys.exit(1)
pos = len(observations['date_time']) - 1