Skip to content

Commit

Permalink
🤹 Prettier error for corrupted images (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Torres authored Apr 17, 2023
1 parent 18386e2 commit 5e3bdca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/converter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def has_rounded_corners(fig: dict) -> bool:
"IMG001": "appears to be corrupted in the .fig file, it will not be converted. Try passing --force-convert-images to try to convert it anyway",
"IMG002": "appears to be corrupted in the .fig file, it will not be converted",
"IMG003": "is missing from the .fig file, it will not be converted",
"IMG004": "appears to be corrupted in the .fig file ({error}), it will not be converted",
}


Expand Down
6 changes: 6 additions & 0 deletions src/figformat/fig2tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,9 @@ def convert_image(fname, blob, fig_zip, output):
except KeyError:
utils.log_conversion_warning("IMG003", {"type": "Image", "guid": fname, "name": fname})
return "f2s_missing"
except Exception as e:
utils.log_conversion_warning(
"IMG004", {"type": "Image", "guid": fname, "name": fname}, error=str(e)
)

return "f2s_corrupted"

0 comments on commit 5e3bdca

Please sign in to comment.