'Possibility to return exception to a try block?
I have a stupid qus. Still any alternate solution would be very helpful.
I have a try block in source which calls few functions.
def main(self):
try:
dict_1 = some_fun_a(self)
dict_2 = some_fun_b(self)
#some operations in dict
except KeyError:
#Raise some exception error.
def some_fun_a(self):
try:
#some validation regarding original data
except ImportError:
#Raise Exception
return ImportError
I could inherit func_a/b & change logic as per req. However, when I face exception inside these functions, the main try block is still a success.
QUS: Is there anyway I could return exception from some_fun_a() to main try block such that exception from main() is raised ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
