Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

only serialize failure details if they exist #707

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
return json.dumps(self.to_json(), indent=4, sort_keys=True, default=str)

def to_json(self):
return {
state_dict = {

Check warning on line 63 in ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py

View check run for this annotation

Codecov / codecov/patch

ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py#L63

Added line #L63 was not covered by tests
'instance_id': self.__obj.instance_id,
'name': self.__obj.name,
'runtime_status': self.__obj.runtime_status.name,
Expand All @@ -69,9 +69,11 @@
'serialized_input': self.__obj.serialized_input,
'serialized_output': self.__obj.serialized_output,
'serialized_custom_status': self.__obj.serialized_custom_status,
'failure_details': {
}
if self.__obj.failure_details is not None:
state_dict['failure_details'] = {

Check warning on line 74 in ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py

View check run for this annotation

Codecov / codecov/patch

ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py#L73-L74

Added lines #L73 - L74 were not covered by tests
'message': self.__obj.failure_details.message,
'error_type': self.__obj.failure_details.error_type,
'stack_trace': self.__obj.failure_details.stack_trace,
},
}
}
return state_dict

Check warning on line 79 in ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py

View check run for this annotation

Codecov / codecov/patch

ext/dapr-ext-workflow/dapr/ext/workflow/workflow_state.py#L79

Added line #L79 was not covered by tests