show how to handle errors

This commit is contained in:
Matt Cooper 2019-08-31 07:02:58 -04:00 committed by GitHub
parent 78bcc281cd
commit 5b6412f849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,8 @@
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:
print(str(e.status) + ' ' + e.code + ': ' + e.details)