Skip to content

Commit

Permalink
in verbose mode, print stack trace (#1594)
Browse files Browse the repository at this point in the history
Make Black failures easier to debug
  • Loading branch information
JelleZijlstra authored Aug 13, 2020
1 parent 97c11f2 commit 8842c5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/black/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ def reformat_one(
write_cache(cache, [src], mode)
report.done(src, changed)
except Exception as exc:
if report.verbose:
traceback.print_exc()
report.failed(src, str(exc))


Expand Down Expand Up @@ -3327,7 +3329,7 @@ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]:
new_line.append(string_leaf)

append_leaves(
new_line, line, LL[string_idx + 1 : rpar_idx] + LL[rpar_idx + 1 :],
new_line, line, LL[string_idx + 1 : rpar_idx] + LL[rpar_idx + 1 :]
)

LL[rpar_idx].remove()
Expand Down

0 comments on commit 8842c5f

Please sign in to comment.