Skip to content

Improve client WorkflowFailedException message with the reason #1095

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

Spikhalskiy
Copy link
Contributor

@Spikhalskiy Spikhalskiy commented Mar 23, 2022

Improves top client WorkflowFailedException message by making it more human-readable and enriches it with the reason (terminated, canceled, timed_out, failed) to make what happened with the workflow immediately clear without looking at the root exception down the stack.

Simplifies exception wrapping and handling to avoid non-needed intermediate representation.

Before: WorkflowExecutionUtils.getResultFromCloseEvent throws internal WorkflowExecutionFailedException and client facing WorkflowFailedException. WorkflowExecutionFailedException gets converted to WorkflowFailedException higher in the chain (in the stubs themselves).

After: WorkflowExecutionUtils.getResultFromCloseEvent throws just WorkflowFailedException.

Improves top client WorkflowFailedException message by making it more human-readable and enriches it with the reason (terminated, canceled, timed_out, failed) to make what happened with the workflow immediately clear without looking at the root exception down the stack.
Simplifies exception wrapping and handling to avoid non-needed intermediate representation.
@Spikhalskiy Spikhalskiy force-pushed the workflowfailedexception-eventid branch from 74dac80 to e943114 Compare March 23, 2022 18:42
long workflowTaskCompletedEventId,
RetryState retryState) {
return "workflowId='"
return "Workflow execution "
Copy link
Member

Choose a reason for hiding this comment

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

This would look much nicer with Guava's MoreObjects.ToStringHelper :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We try our best to don't use Guava where it's not absolutely needed :) Also, this one is not a standard toString, it's a message and it's customized a little.

Copy link
Member

Choose a reason for hiding this comment

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

I find even a string builder is easier to read than all these concatenations (granted that's what the JVM compiles this down to anyways)

@Spikhalskiy Spikhalskiy merged commit 5d8caab into temporalio:master Mar 23, 2022
@Spikhalskiy Spikhalskiy deleted the workflowfailedexception-eventid branch April 15, 2022 19:58
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants