Scrython/examples/handle_errors.py

9 lines
346 B
Python
Raw Normal View History

2019-08-31 11:02:58 +00:00
import scrython
# oops, we asked for an exact match to a card, but failed to put the name in quotes
# that's going to throw a Scryfall error
try:
search = scrython.cards.Search(q="!Black Lotus")
except scrython.ScryfallError as e:
2019-09-03 13:31:47 +00:00
print(str(e.error_details['status']) + ' ' + e.error_details['code'] + ': ' + e.error_details['details'])