Propagate exact binding import error in --trace or --debug mode

Create issue
Issue #209 duplicate
anatoly techtonik created an issue

It is hard to troubleshoot binding import errors, especially when Mercurial distribution is frozen. That's why it would be very helpful to get exact import error in --trace or --debug mode instead of generic: {{{ abort: subvertpy 0.7.3 or later required, but not found! }}}

Comments (12)

  1. anatoly techtonik reporter

    That's not really a duplicate, because in --debug mode I want to get exact import exception text from the lowest level, i.e. abort: No module named svn!

  2. Dan Villiom Podlaski Christiansen

    That would be rather presumptuous of me, considering that Augie is the project maintainer. To me, this bug seems subtly different from the other one, but harder to fix. A proper fix would require support for exception chaining.

  3. anatoly techtonik reporter

    I can't see any problems with exception chaining, just show me how to check if --trace or --debug mode is active and I'll be able to send you a patch.

  4. Dan Villiom Podlaski Christiansen

    I believe you misunderstood me. There are two problems, here: 1) Exception chaining hasn't been implemented in any of the Python versions we support, nor has it in Mercurial. 2) The code where the ImportError is intercepted does not have access to a Mercurial UI instance, which would be necessary for determining whether verbose or debug output is used.

    In order to fix this, you would have to first implement support for exception chaining in Mercurial, and then add support allow hgsubversion to use it.

  5. anatoly techtonik reporter

    What do you call 'exception chaining'? Why executing 'raise' without argument is not enough to pass the current exception up?

  6. Dan Villiom Podlaski Christiansen

    Messages such as ‘No module named svn’ or ‘No module named subvertpy’ simply aren't helpful. Instead, we intercept the exception and raise another one with a more helpful message. From my perspective, the vast majority of our users couldn't care less about tracebacks and original exception messages.

    Exception chaining is a technique which allows you to associate one exception with another. It would allow us to improve on error messages, which retaining the original message for exactness. It should be implemented in the Mercurial traceback routines.

  7. anatoly techtonik reporter

    The absolute majority of your Windows users will need to troubleshoot issues with Subversion bindings, but this request is only for advantage to those who know about --trace and --debug.

    In trace or debug mode it is not the message that is important, but the pointer to the exact place where a problem occurred. Re-thrown "user-friendly" message doesn't allow to troubleshoot this point. And this message often change, when, for example - there is 'svn' module, but some '_client' C level dependency is not satisfied.

  8. Augie Fackler repo owner

    We can't go poking for --traceback or --debug flags at module import time - there's no way for us to have a ui.ui object to look, and we're definitely not going to reimplement the flags parsing for that.

    Unless we get a *clear* notion from users that we need something along these lines, I'd rather we didn't spend more time discussing it. I'd welcome some documentation on diagnosing bindings issues for Windows users. I don't know the first thing about Windows, and usually just send people off to talk to the TortoiseHG folks.

  9. Log in to comment