1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
######################################################################
#
# File: b2sdk/_internal/account_info/exception.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import annotations
from abc import ABCMeta
from ..exception import B2Error
class AccountInfoError(B2Error, metaclass=ABCMeta):
"""
Base class for all account info errors.
"""
pass
class CorruptAccountInfo(AccountInfoError):
"""
Raised when an account info file is corrupted.
"""
def __init__(self, file_name):
"""
:param file_name: an account info file name
:type file_name: str
"""
super().__init__()
self.file_name = file_name
def __str__(self):
return (
f'Account info file ({self.file_name}) appears corrupted. '
f'Try removing and then re-authorizing the account.'
)
class MissingAccountData(AccountInfoError):
"""
Raised when there is no account info data available.
"""
def __init__(self, key):
"""
:param key: a key for getting account data
:type key: str
"""
super().__init__()
self.key = key
def __str__(self):
return f'Missing account data: {self.key}'
|