From f6b26f4eade09f65986e87019b392f3f2c019b88 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 1 Jun 2021 09:10:58 +0000 Subject: [PATCH] Fix unexpected exception when credential file not found --- PFERD/__main__.py | 3 ++- PFERD/auth/__init__.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PFERD/__main__.py b/PFERD/__main__.py index 1cca8b1..5ae62bb 100644 --- a/PFERD/__main__.py +++ b/PFERD/__main__.py @@ -5,6 +5,7 @@ import os import sys from pathlib import Path +from .auth import AuthLoadError from .cli import PARSER, ParserLoadError, load_default_section from .config import Config, ConfigDumpError, ConfigLoadError, ConfigOptionError from .logging import log @@ -134,7 +135,7 @@ def main() -> None: loop.close() else: asyncio.run(pferd.run(args.debug_transforms)) - except ConfigOptionError as e: + except (ConfigOptionError, AuthLoadError) as e: log.unlock() log.error(str(e)) sys.exit(1) diff --git a/PFERD/auth/__init__.py b/PFERD/auth/__init__.py index eff8370..06b3ba4 100644 --- a/PFERD/auth/__init__.py +++ b/PFERD/auth/__init__.py @@ -2,7 +2,7 @@ from configparser import SectionProxy from typing import Callable, Dict from ..config import Config -from .authenticator import Authenticator, AuthError, AuthSection # noqa: F401 +from .authenticator import Authenticator, AuthError, AuthLoadError, AuthSection # noqa: F401 from .credential_file import CredentialFileAuthenticator, CredentialFileAuthSection from .keyring import KeyringAuthenticator, KeyringAuthSection from .simple import SimpleAuthenticator, SimpleAuthSection