Improve error messages for card parsing

This commit is contained in:
tooomm 2026-01-11 10:07:36 +01:00 committed by GitHub
parent 9815ca0bf6
commit 6f8693a77f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -250,12 +250,13 @@ def scryfall2mtgjson(scryfall_cards: List[Dict[str, Any]]) -> List[Dict[str, Any
"subTypes": sub_types,
}
trice_cards.append(trice_card)
except Exception as e:
# If running in GitHub Actions CI, print the message as a warning
if 'GITHUB_ACTION' in os.environ:
print(f"::warning::Unable to parse {sf_card.get('name')} ({sf_card.get('set')}): {str(e)}")
print(f'::warning::Unable to parse "{sf_card.get("name")}" ({sf_card.get("set").upper()}): {str(e)}')
else:
print(f"Unable to parse {sf_card.get('name')} ({sf_card.get('set')}): {str(e)}")
print(f'Unable to parse "{sf_card.get("name")}" ({sf_card.get("set").upper()}): {str(e)}')
return trice_cards