Python
Python: Error handling # 에러를 어떻게 다룰지를 쉽게 파악해보자
taltal
2023. 9. 9. 19:00
728x90
반응형
Error handling을 어떻게 할지 도구들을 살펴보자
def is_callable(obj):
try:
call_result = obj()
return {"callable":True, "result": call_result}
except:
return {"callable":False, "result": obj}
try:
"""Some Error Logic"""
except Exception as e:
for i in dir(e):
print(i, is_callable(eval(f"e.{i}")))
위와 같이 하면 Exception을 어떤 method를 통해 다룰지 살펴보기 좋다.
728x90
반응형