Skip to content

except Exception in progress coding hiding bugs #435

Closed
@barry-scott

Description

@barry-scott

I have just spent an hour debugging my first progress code for clone_from.

I had a silly bug in my code, but because of this:

       try:
            handler(line)
        except Exception:

I did not see any errors.

This code is in _dispatch_single_line or func handle_process_output in cmd.py

I do not see why you have this try handler at all.
Given that I have no logger file setup in my code that this experiment was conducted in
the logged error is silent.

I recommend that you remove the try/except altogether.

If you have a good reason to keep the try/except then use
log.exception( 'msg' )
that will include the traceback details.

Activity

self-assigned this
on May 24, 2016
Byron

Byron commented on May 24, 2016

@Byron
Member

I totally agree that catching all exceptions is bad practice, and am sorry to hear you spend so much time to trace that down.

The code I see in the latest version (please note it's always a good idea to state which version you are using ;)) is logging the exception accordingly.

Maybe the intention of this was to assure the line handler will never interrupt an ongoing fetch or pull. Changing this now would be a breaking change for buggy handler code ... but probably it's nothing to worry about anyway.

Thinking about it this way, I believe it's a good thing to change it.

added this to the v2.0.3 - Bugfixes milestone on May 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Byron@barry-scott

      Issue actions

        except Exception in progress coding hiding bugs · Issue #435 · gitpython-developers/GitPython