summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-06 02:30:28 +0100
committernfnty <git@nfnty.se>2017-02-06 02:30:28 +0100
commit9a619526f472cce3997b2aa89c13532cf8f005e1 (patch)
treee1eb8523806138b247bcd085c7203df9ed9a9930 /ranger
parent41478b10c5a0bace85c74bc7388b3818c8f86ab4 (diff)
downloadranger-9a619526f472cce3997b2aa89c13532cf8f005e1.tar.gz
core.main: Catch the right traceback
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/main.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 444f0287..0189aa2b 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -161,23 +161,29 @@ def main(
             profile = pstats.Stats(profile_file, stream=sys.stderr)
         else:
             fm.loop()
+
     except Exception:  # pylint: disable=broad-except
         import traceback
+        ex_traceback = traceback.format_exc()
+
         exit_msg += '''\
 ranger version: {0}
 Python version: {1}
 Locale: {2}
 '''.format(ranger.__version__, sys.version.split()[0],
            '.'.join(str(s) for s in locale.getlocale()))
+
         try:
             exit_msg += "Current file: '{0}'\n".format(fm.thisfile.path)
-        except AttributeError:
+        except Exception:  # pylint: disable=broad-except
             pass
+
         exit_msg += '''
 {0}
 ranger crashed. Please report this traceback at:
-https://github.com/hut/ranger/issues
-'''.format(traceback.format_exc())
+https://github.com/ranger/ranger/issues
+'''.format(ex_traceback)
+
         exit_code = 1
 
     except SystemExit as ex:
@@ -187,6 +193,7 @@ https://github.com/hut/ranger/issues
                 exit_code = 1
             else:
                 exit_code = ex.code
+
     finally:
         if exit_msg:
             LOG.critical(exit_msg)