python-CSD-kursu/python-temel/exception.example.10.py
2023-08-22 11:22:01 +03:00

19 lines
431 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def bar(a):
print('bar başladı')
if a < 0:
raise ValueError('Argüman negatif olamaz')
print('bar bitti')
def foo(a):
print('foo başladı')
try:
bar(a)
except Exception as e:
print(f"Exception foo'da ele alındı ve yeniden fırlatılıyor: {e}")
raise
print('foo bitti')
try:
foo(-10)
except Exception as e:
print(f'Exception dışarıda ele alındı: {e}')