Skip to content

Commit

Permalink
only serialize failure details if they exist (#707)
Browse files Browse the repository at this point in the history
* only serialize failure details if they exist

Signed-off-by: Akshaya Annavajhala <akshaya-a@users.noreply.github.com>

* Pin workflow SDK 0.4.1 in example (#715)

* Pin workflow SDK 0.4.1 in example

Signed-off-by: Bernd Verst <github@bernd.dev>

* fix workflow dev version

Signed-off-by: Bernd Verst <github@bernd.dev>

* fix workflow example dependency

Signed-off-by: Bernd Verst <github@bernd.dev>

---------

Signed-off-by: Bernd Verst <github@bernd.dev>
Signed-off-by: Akshaya Annavajhala <akshaya-a@users.noreply.github.com>

---------

Signed-off-by: Akshaya Annavajhala <akshaya-a@users.noreply.github.com>
Signed-off-by: Bernd Verst <github@bernd.dev>
Co-authored-by: Bernd Verst <github@bernd.dev>
  • Loading branch information
akshaya-a and berndverst authored Jun 26, 2024
1 parent 477acd3 commit 73e35de
Showing 1 changed file with 6 additions and 4 deletions.
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 @@ def __str__(self) -> str:
return json.dumps(self.to_json(), indent=4, sort_keys=True, default=str)

def to_json(self):
return {
state_dict = {
'instance_id': self.__obj.instance_id,
'name': self.__obj.name,
'runtime_status': self.__obj.runtime_status.name,
Expand All @@ -69,9 +69,11 @@ def to_json(self):
'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'] = {
'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

0 comments on commit 73e35de

Please sign in to comment.