from com.abc.banking.account import Account from com.abc.banking.exceptions.min_bal_error import MinBalError from traceback import print_exc a1 = Account('mehul', 'savings', 10000) try: print(a1.withdraw(8000)) except MinBalError: print('Min bal not mantained') print_exc() except ValueError: print_exc()
from com.abc.banking.account import Account from com.abc.banking.overdrafterror import OverdraftError from traceback import print_exc a = Account(acc_name='mehul', acc_type='Savings', acc_balance=10000) try: ub = a.withdraw(900) except OverdraftError: print_exc() except ValueError: print_exc() else: print(ub) ''' try: ub = a.withdraw(-4500) except Exception: # catch all exception block print_exc() ''' # avoid it
from com.abc.banking.account import Account from com.abc.banking.minbalerror import MinBalNotMaintainedError from traceback import print_exc a = Account(acc_name='mehul chopra', acc_no=1234, acc_balance=10000) try: ub = a.withdraw(500000) except MinBalNotMaintainedError: # print traceback print_exc() except ValueError: print_exc() else: print(ub) # avoid this ''' try: ub = a.withdraw(9500) except Exception: # catch all exception block print_exc() '''