Pointers on including conversion of FileNotFoundError

Issue #43 new
Jelte Fennema
created an issue

For my project I want to do automatic conversion of FileNotFoundError to code like this: http://stackoverflow.com/a/26745443/2570866. Do you have any pointers on refactoring something like this?

Comments (1)

  1. Joe Amenta repo owner

    Hmm, it's been a really long time since I've done any real work on this project, so I'm super rusty about it.

    I think the pattern to match would be the next-level-up from what fix_except matches, then in the fix it would replace the type of the exception to catch, then inject a copy of the "re-raise on an ERRNO other than ENOENT" tree to the beginning of the "suite" node following the "except_clause" (if there's no "suite" because it's a one-liner, there's a "suitify" func in fixer_util that you can use).

    Does that help?

  2. Log in to comment