Skip to content

Exceptions

Ankit_Anmol edited this page Dec 1, 2021 · 6 revisions

Catching exceptions:

You can find the full list of exceptions .

To catch am exception:

from ScraGet import ScraGet, Exceptions #Importing the exceptions

user = ScraGet.get_user()
try: #to handle error
  user.updateScratch("Hello world! Hello? Hi.... anyone?") #this user doesn't exist. So this should throw an error
except Exceptions.UserNotFound:
  print("OH..  this user doesn't exist!!")
Clone this wiki locally