From 2029f52fdcc30810db88bf2c68dcbeeaa3cf7d52 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 17 Jun 2018 20:52:35 +0200 Subject: [PATCH] Show cause when ~/.netrc can't be read --- doc/changelog.asciidoc | 2 ++ qutebrowser/browser/shared.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 58cc880c4..c919eac5c 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -90,6 +90,8 @@ Changed - On Qt 5.10 or newer, dictionaries are now read from the qutebrowser data directory (e.g. `~/.local/share/qutebrowser`) instead of `/usr/share/qt`. Existing dictionaries are copied over. +- If an error while parsing `~/.netrc` occurs, the cause of the error is now + logged. Fixed ~~~~~ diff --git a/qutebrowser/browser/shared.py b/qutebrowser/browser/shared.py index 8ebbe3926..31f00f52c 100644 --- a/qutebrowser/browser/shared.py +++ b/qutebrowser/browser/shared.py @@ -312,10 +312,10 @@ def netrc_authentication(url, authenticator): (user, _account, password) = authenticators except FileNotFoundError: log.misc.debug("No .netrc file found") - except OSError: - log.misc.exception("Unable to read the netrc file") - except netrc.NetrcParseError: - log.misc.exception("Error when parsing the netrc file") + except OSError as e: + log.misc.exception("Unable to read the netrc file: {}".format(e)) + except netrc.NetrcParseError as e: + log.misc.exception("Error when parsing the netrc file: {}".format(e)) if user is None: return False