diff options
author | Casey Deccio <casey@deccio.net> | 2019-09-05 20:35:51 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2019-09-05 20:35:51 +0300 |
commit | 8849aeddcff6a9980c314f57b0051b997a0b0bd4 (patch) | |
tree | 56e38f9ad2141e023c525c816215fe9af6c5ffb3 | |
parent | 0d54c9c049e152eb8b9ee785eaf2e56a1789b672 (diff) |
Handle exceptions with both python2 and python3flagday
-rw-r--r-- | dnsviz/analysis/online.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dnsviz/analysis/online.py b/dnsviz/analysis/online.py index e5efcbc..34e20c9 100644 --- a/dnsviz/analysis/online.py +++ b/dnsviz/analysis/online.py @@ -2098,7 +2098,12 @@ class Analyst(object): # raise only the first exception, but log all the ones beyond for name, exc_info in errors[1:]: self.logger.error('Error analyzing %s' % name, exc_info=exc_info) - raise errors[0][1][0].with_traceback(errors[0][1][2]) + # python3/python2 dual compatibility + if hasattr(errors[0][1][0], 'with_traceback'): + raise errors[0][1][1].with_traceback(errors[0][1][2]) + else: + # lesser python2 functionality + exec('raise errors[0][1][1], None, errors[0][1][2]') def _mix_case(self, name): name = name.to_text().lower() |