Answer the question
In order to leave comments, you need to log in
What is the correct way to debug try ... except in Python?
There is some code like this:
try:
validate(request_json, request_json_schema)
except ValidationError:
print('Schema not valid!')
return False
validate(request_json, request_json_schema)throws an exception everything is fine. We process and work.
Answer the question
In order to leave comments, you need to log in
try:
validate(request_json, request_json_schema)
except ValidationError as e:
print('Schema not valid, и вот почему:')
print(e)
You can also use `logger`:
import logging
try:
validate(request_json, request_json_schema)
except ValidationError as e:
print('Schema not valid, и вот почему:')
logging.exception(e)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question