Merge pull request #8284 from ThomasWaldmann/fix-8256

fix error handling (master)
This commit is contained in:
TW 2024-07-15 12:43:24 +02:00 committed by GitHub
commit dc25205287
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View File

@ -5,7 +5,7 @@ from ._common import with_repository, Highlander
from ..archive import Archive, Statistics from ..archive import Archive, Statistics
from ..cache import Cache from ..cache import Cache
from ..constants import * # NOQA from ..constants import * # NOQA
from ..helpers import log_multi, format_archive, sig_int from ..helpers import log_multi, format_archive, sig_int, CommandError, Error
from ..manifest import Manifest from ..manifest import Manifest
from ..logger import create_logger from ..logger import create_logger
@ -24,11 +24,10 @@ class DeleteMixIn:
if not archive_names: if not archive_names:
return return
if args.match_archives is None and args.first == 0 and args.last == 0: if args.match_archives is None and args.first == 0 and args.last == 0:
self.print_error( raise CommandError(
"Aborting: if you really want to delete all archives, please use -a 'sh:*' " "Aborting: if you really want to delete all archives, please use -a 'sh:*' "
"or just delete the whole repository (might be much faster)." "or just delete the whole repository (might be much faster)."
) )
return
if args.forced == 2: if args.forced == 2:
deleted = False deleted = False

View File

@ -4,7 +4,7 @@ from collections import defaultdict
from ._common import with_repository, Highlander from ._common import with_repository, Highlander
from ..constants import * # NOQA from ..constants import * # NOQA
from ..compress import CompressionSpec, ObfuscateSize, Auto, COMPRESSOR_TABLE from ..compress import CompressionSpec, ObfuscateSize, Auto, COMPRESSOR_TABLE
from ..helpers import sig_int, ProgressIndicatorPercent from ..helpers import sig_int, ProgressIndicatorPercent, Error
from ..manifest import Manifest from ..manifest import Manifest
@ -150,7 +150,7 @@ class RCompressMixIn:
pi.finish() pi.finish()
if sig_int: if sig_int:
# Ctrl-C / SIGINT: do not checkpoint (commit) again, we already have a checkpoint in this case. # Ctrl-C / SIGINT: do not checkpoint (commit) again, we already have a checkpoint in this case.
self.print_error("Got Ctrl-C / SIGINT.") raise Error("Got Ctrl-C / SIGINT.")
elif uncommitted_chunks > 0: elif uncommitted_chunks > 0:
checkpoint_func() checkpoint_func()
if args.stats: if args.stats: