comparison mercurial/fancyopts.py @ 45837:2eb8ad899fa6

errors: raise InputError in fancyopts If a value of wrong type is passed to a command line flag, that's cleary an InputError. Differential Revision: https://phab.mercurial-scm.org/D9308
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 12 Nov 2020 08:29:55 -0800
parents 9d2b2df2c2ba
children d4ba4d51f85f
comparison
equal deleted inserted replaced
45836:de1f4c431619 45837:2eb8ad899fa6
378 if obj._isboolopt(): 378 if obj._isboolopt():
379 state[name] = boolval 379 state[name] = boolval
380 else: 380 else:
381 381
382 def abort(s): 382 def abort(s):
383 raise error.Abort( 383 raise error.InputError(
384 _(b'invalid value %r for option %s, %s') 384 _(b'invalid value %r for option %s, %s')
385 % (pycompat.maybebytestr(val), opt, s) 385 % (pycompat.maybebytestr(val), opt, s)
386 ) 386 )
387 387
388 state[name] = defmap[name].newstate(state[name], val, abort) 388 state[name] = defmap[name].newstate(state[name], val, abort)