Last active
June 10, 2018 06:22
-
-
Save Kento75/3ce46a77ed183bb30d92bfa9af33f47b to your computer and use it in GitHub Desktop.
【Pythonメモ 】例外を呼び出し元に送信する方法 ref: https://qiita.com/Kento75/items/b0f43943d300d0ed9586
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- Coding: utf-8 -*- | |
class Hoge(object): | |
def huga(): | |
try: | |
raise TypeError('TYPE ERROR!') | |
except Exception as e: | |
print(type(e)) # 1回目のエラー出力 | |
raise # 呼び出し元に再送 | |
try: | |
huga() | |
except Exception as e: | |
print(type(e)) # 2回目のエラー出力 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment