Mercurial > public > mercurial-scm > hg
comparison mercurial/extensions.py @ 48359:e4e2ce328599
extensions: refactor handling of loading error make it reusable
We will need this in the next patch.
Differential Revision: https://phab.mercurial-scm.org/D11820
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 26 Nov 2021 16:55:34 +0100 |
parents | c6d44457f7e3 |
children | e4acdf5d94a2 |
comparison
equal
deleted
inserted
replaced
48358:c6d44457f7e3 | 48359:e4e2ce328599 |
---|---|
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 ui.warn( | 310 error_msg = _(b"failed to import extension %s from %s: %s") |
311 _(b"*** failed to import extension %s from %s: %s\n") | 311 error_msg %= (name, path, msg) |
312 % (name, path, msg) | |
313 ) | |
314 else: | 312 else: |
315 ui.warn( | 313 error_msg = _(b"failed to import extension %s: %s") |
316 _(b"*** failed to import extension %s: %s\n") | 314 error_msg %= (name, msg) |
317 % (name, msg) | 315 ui.warn((b"*** %s\n") % error_msg) |
318 ) | |
319 if isinstance(inst, error.Hint) and inst.hint: | 316 if isinstance(inst, error.Hint) and inst.hint: |
320 ui.warn(_(b"*** (%s)\n") % inst.hint) | 317 ui.warn(_(b"*** (%s)\n") % inst.hint) |
321 ui.traceback() | 318 ui.traceback() |
322 | 319 |
323 ui.log( | 320 ui.log( |