- raise WrongArgumentsError(
- u'Command "%s" takes %s %s argument%s, %s given.'
- % (handler.__name__, quant, n_ok, pl, n_bad))
+ e = WrongArgumentsError(handler, u'takes %s %s argument%s, '
+ '%s given' % (quant, n_ok, pl, n_bad))
+ log.debug(u'Dispatcher.dispatch: wrong arguments (%r)', e)
+ raise e
+ m = kw_re.match(unicode(e))
+ if m:
+ (kw,) = m.groups()
+ e = WrongArgumentsError(handler,
+ u'got an unexpected keyword argument %s' % kw)
+ log.debug(u'Dispatcher.dispatch: wrong arguments (%r)', e)
+ raise e
+ log.debug(u'Dispatcher.dispatch: some other TypeError, re-raising')