Skip to content

Commit

Permalink
also parse tabs to spaces for pretty print
Browse files Browse the repository at this point in the history
  • Loading branch information
mki-c2c committed Jan 31, 2025
1 parent 6f68bc1 commit 8df6bd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion geonetwork/gn_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def put_record_zip(self, zipdata: IO[bytes], overwrite: bool = True) -> Any:
clean_error_stack = [
{
**err,
"stack": err["stack"].split("\n")
"stack": [t.replace("\t", " ") for t in err["stack"].split("\n")]
}
for err in results["errors"]
]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_gn_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def record_callback(request, context):
return {
"errors": [
{"message": "err1", "stack": "line1\nline2"},
{"message": "err2", "stack": "e2/line1\ne2/line2"},
{"message": "err2", "stack": "e2/line1\n\tat e2/line2"},
]
}
m.post('http://geonetwork/api/records', json=record_callback)
Expand All @@ -125,5 +125,5 @@ def record_callback(request, context):
assert err.value.args[0]["code"] == 404
assert err.value.args[0]["details"] == [
{"message": "err1", "stack": ["line1", "line2"]},
{"message": "err2", "stack": ["e2/line1", "e2/line2"]},
{"message": "err2", "stack": ["e2/line1", " at e2/line2"]},
]

0 comments on commit 8df6bd3

Please sign in to comment.