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
|
######################################################################
#
# File: b2sdk/v1/exception.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from __future__ import annotations
from b2sdk.v2.exception import * # noqa
v2DestFileNewer = DestFileNewer
# This exception class is deprecated and should not be used in new designs
class CommandError(B2Error):
"""
b2 command error (user caused). Accepts exactly one argument: message.
We expect users of shell scripts will parse our ``__str__`` output.
"""
def __init__(self, message):
super().__init__()
self.message = message
def __str__(self):
return self.message
class DestFileNewer(v2DestFileNewer):
def __init__(self, dest_file, source_file, dest_prefix, source_prefix):
super(v2DestFileNewer, self).__init__()
self.dest_file = dest_file
self.source_file = source_file
self.dest_prefix = dest_prefix
self.source_prefix = source_prefix
def __str__(self):
return f'source file is older than destination: {self.source_prefix}{self.source_file.name} with a time of {self.source_file.latest_version().mod_time} cannot be synced to {self.dest_prefix}{self.dest_file.name} with a time of {self.dest_file.latest_version().mod_time}, unless a valid newer_file_mode is provided'
|