Fix unexpected exception when credential file not found

This commit is contained in:
Joscha 2021-06-01 09:10:58 +00:00
parent 722970a255
commit f6b26f4ead
2 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import os
import sys import sys
from pathlib import Path from pathlib import Path
from .auth import AuthLoadError
from .cli import PARSER, ParserLoadError, load_default_section from .cli import PARSER, ParserLoadError, load_default_section
from .config import Config, ConfigDumpError, ConfigLoadError, ConfigOptionError from .config import Config, ConfigDumpError, ConfigLoadError, ConfigOptionError
from .logging import log from .logging import log
@ -134,7 +135,7 @@ def main() -> None:
loop.close() loop.close()
else: else:
asyncio.run(pferd.run(args.debug_transforms)) asyncio.run(pferd.run(args.debug_transforms))
except ConfigOptionError as e: except (ConfigOptionError, AuthLoadError) as e:
log.unlock() log.unlock()
log.error(str(e)) log.error(str(e))
sys.exit(1) sys.exit(1)

View File

@ -2,7 +2,7 @@ from configparser import SectionProxy
from typing import Callable, Dict from typing import Callable, Dict
from ..config import Config 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 .credential_file import CredentialFileAuthenticator, CredentialFileAuthSection
from .keyring import KeyringAuthenticator, KeyringAuthSection from .keyring import KeyringAuthenticator, KeyringAuthSection
from .simple import SimpleAuthenticator, SimpleAuthSection from .simple import SimpleAuthenticator, SimpleAuthSection