diff --git a/python-temel/exception.example.10.py b/python-temel/exception.example.10.py new file mode 100644 index 0000000..707408a --- /dev/null +++ b/python-temel/exception.example.10.py @@ -0,0 +1,18 @@ +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}')