comparison mercurial/extensions.py @ 48360:e4acdf5d94a2

extensions: highlight the name of the faulty extensions in the error message This make it easier to understand the message when the extensions name is common. Differential Revision: https://phab.mercurial-scm.org/D11821
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 29 Nov 2021 13:09:04 +0100
parents e4e2ce328599
children 0d0ce2529540
comparison
equal deleted inserted replaced
48359:e4e2ce328599 48360:e4acdf5d94a2
305 try: 305 try:
306 load(ui, name, path, loadingtime) 306 load(ui, name, path, loadingtime)
307 except Exception as inst: 307 except Exception as inst:
308 msg = stringutil.forcebytestr(inst) 308 msg = stringutil.forcebytestr(inst)
309 if path: 309 if path:
310 error_msg = _(b"failed to import extension %s from %s: %s") 310 error_msg = _(
311 b'failed to import extension "%s" from %s: %s'
312 )
311 error_msg %= (name, path, msg) 313 error_msg %= (name, path, msg)
312 else: 314 else:
313 error_msg = _(b"failed to import extension %s: %s") 315 error_msg = _(b'failed to import extension "%s": %s')
314 error_msg %= (name, msg) 316 error_msg %= (name, msg)
315 ui.warn((b"*** %s\n") % error_msg) 317 ui.warn((b"*** %s\n") % error_msg)
316 if isinstance(inst, error.Hint) and inst.hint: 318 if isinstance(inst, error.Hint) and inst.hint:
317 ui.warn(_(b"*** (%s)\n") % inst.hint) 319 ui.warn(_(b"*** (%s)\n") % inst.hint)
318 ui.traceback() 320 ui.traceback()