Skip to content

Commit 0f33b3b

Browse files
authored
Merge pull request #309 from python-jsonschema/improve-simplified-traceback-indents
Improve formatting of multiline errors
2 parents ce0de5c + a40b57c commit 0f33b3b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/check_jsonschema/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import pathlib
66
import re
7+
import textwrap
78
import traceback
89
import typing as t
910
import urllib.parse
@@ -94,7 +95,7 @@ def filename2path(filename: str) -> pathlib.Path:
9495

9596
def format_shortened_error(err: Exception, *, indent: int = 0) -> str:
9697
lines = []
97-
lines.append(indent * " " + f"{type(err).__name__}: {err}")
98+
lines.append(textwrap.indent(f"{type(err).__name__}: {err}", indent * " "))
9899
if err.__traceback__ is not None:
99100
lineno = err.__traceback__.tb_lineno
100101
tb_frame = err.__traceback__.tb_frame

0 commit comments

Comments
 (0)