mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
More helpful error message when passing an invalid column label to calibredb remove_custom_column
This commit is contained in:
parent
85cb16265f
commit
d96ebb1f2b
@ -947,11 +947,16 @@ def command_custom_columns(args, dbpath):
|
||||
|
||||
def do_remove_custom_column(db, label, force):
|
||||
if not force:
|
||||
q = raw_input(_('You will lose all data in the column: %r.'
|
||||
q = raw_input(_('You will lose all data in the column: %s.'
|
||||
' Are you sure (y/n)? ')%label)
|
||||
if q.lower().strip() != _('y'):
|
||||
return
|
||||
db.delete_custom_column(label=label)
|
||||
try:
|
||||
db.delete_custom_column(label=label)
|
||||
except KeyError:
|
||||
prints(_('No column named %s found. You must use column labels, not titles.'
|
||||
' Use calibredb custom_columns to get a list of labels.')%label, file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
prints('Column %r removed.'%label)
|
||||
|
||||
def remove_custom_column_option_parser():
|
||||
|
Loading…
x
Reference in New Issue
Block a user