Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Catch step exceptions #345

Merged
merged 9 commits into from
Apr 29, 2020
Merged

Conversation

changlong-liu
Copy link
Member

fix issue #328: clear internal resources even when test failed

raise exceptions[0][1][1]
message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1]))
message += "\n".join(["{}: {}".format(h[0], h[1][1]) for h in exceptions[1:]])
raise exceptions[0][1][0](message).with_traceback(exceptions[0][1][2])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is exceptions a three demensions array? or one demension but with dictionary type element ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to Line 66:

output.push('            exceptions.append((func.__name__, sys.exc_info()))');

The exceptions is an array of (step_name, exception_info), where step_name is a string, and exception_info is a 3 elements tuple:
exception_info -> (exception_type, exception_instance, stack_info)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. Is exception_instance a string type?
message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1]))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it should be some subclass of BaseException

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then are you sure this line work
message = "{}\nFollowed with exceptions in other steps:\n".format(str(exceptions[0][1][1]))

@qiaozha qiaozha merged commit 11c9cf5 into Azure:master Apr 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants