Michael B
Michael B

Reputation: 94

raise the exception in a try/except and continue

so basically I have a loop and for each step, I run a function in a try/except. When there is an error caught, I have a generic error message that doesn't allow me to understand what went wrong.

How do I have the real python built-in error message (raise) and still continue to run the loop?

Thanks.

Upvotes: 0

Views: 59

Answers (1)

naivepredictor
naivepredictor

Reputation: 898

Sample code:

for i in [...]:
    try:
        func1(i)
    except Exception as ex:
        print(ex)
        func2(i)

Upvotes: 1

Related Questions