Annotating all subrepo errors, not just util.Abort

Angel Ezquerra angel.ezquerra at gmail.com
Tue Jan 15 16:44:16 CST 2013


Today I noticed that despite 9e3910db4e78 (subrepo: append subrepo
path to subrepo error messages), there are subrepo error messages that
are not properly annotated with the new '(in subrepo XXX)' string.

This happens when the error is due to an exception that is not of type
util.Abort. For example HTTP errors, which are some of the most common
errors (which can happen when pulling or pushing the parent repo),
will not be annotated.

Thus I'd like to annotate those errors as well. I see a couple of solutions:

1. Do this on a case by case basis, e.g. create a SubrepoHttpError
2. Do some meta-programming to create different SubrepoError classes
that are derived from the type of the exception that is generated by
the subrepo.

#1 is probably much simpler but if I find more cases where this may
happen I may end up with a lot of duplicated code.

Thoughts?

Angel


More information about the Mercurial-devel mailing list