File: exception.py

package info (click to toggle)
python-b2sdk 2.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,228 kB
  • sloc: python: 32,094; sh: 13; makefile: 8
file content (35 lines) | stat: -rw-r--r-- 1,044 bytes parent folder | download
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
######################################################################
#
# File: b2sdk/v2/exception.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import annotations

from b2sdk.v3.exception import *  # noqa

v3BucketIdNotFound = BucketIdNotFound
UnSyncableFilename = UnsupportedFilename


# overridden to retain old style isinstance check and attributes
class BucketIdNotFound(v3BucketIdNotFound, BadRequest):
    def __init__(self, bucket_id):
        super().__init__(bucket_id)
        self.message = f'Bucket with id={bucket_id} not found'
        self.code = 'bad_bucket_id'

    def __str__(self):
        return BadRequest.__str__(self)


class RestrictedBucket(B2Error):
    def __init__(self, bucket_name):
        super().__init__()
        self.bucket_name = bucket_name

    def __str__(self):
        return 'Application key is restricted to bucket: %s' % self.bucket_name