I have two functions. function "main" is calling to function "submain". "submain" function contains try-catch block and return some value.
If "submain" executes successfully then it returns some value which i will display to end user directly.
If i get an exception then i have to prepare one user friendly message and print that. But to do that i need to know whether returned value is exception or not.
How can i check that returned value in exception or valid result?
Here is my pseudo code:
def submain():
    try:
        result = call to external API
        return result
    excepion, e:
        _logger(e)
def main(value):
    for x in value:
        submain()
        # if return is exception then break loop and give msg to end user.
 
    