# How to catch ActivityError or ApplicationError from the result() of get\_workflow\_handle()?

**URL:** https://community.temporal.io/t/how-to-catch-activityerror-or-applicationerror-from-the-result-of-get-workflow-handle/9024
**Category:** Community Support
**Tags:** python-sdk
**Created:** [July 31, 2023, 5:16pm UTC](https://community.temporal.io/t/how-to-catch-activityerror-or-applicationerror-from-the-result-of-get-workflow-handle/9024 "2023-07-31T17:16:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![netllama](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@netllama](https://community.temporal.io/u/netllama)
#### Post date: [July 31, 2023, 5:16pm UTC](https://community.temporal.io/t/how-to-catch-activityerror-or-applicationerror-from-the-result-of-get-workflow-handle/9024/1 "2023-07-31T17:16:15Z")

</div>

Occasionally, I have a workflow that does not complete successfully ( Failed status). I’m trying to capture the actual details around the failure (which is associated with an `ApplicationError` exception) from the `result()` method associated with `get_workflow_handle()`.

However, that method throws a `WorkflowFailureError` client exception similar to the following:

```auto
ApplicationError Traceback (most recent call last)
ApplicationError: MyCustomException: Failed to fix aspect: 30800000-4343-4653-3344-4d3134304b30:e_link_width : MyCustomException(StatusCode.NOT_FOUND, Did not find alert to update!)

The above exception was the direct cause of the following exception:

ActivityError Traceback (most recent call last)
ActivityError: Activity task failed

The above exception was the direct cause of the following exception:

WorkflowFailureError Traceback (most recent call last)

```

How can I get the `ApplicationError` exception? I can’t catch that exception from `result()`.

---

<div class="post-metadata">

### Author: ![Chad\_Retz](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chad_retz/32/1396_2.png) [@Chad\_Retz](https://community.temporal.io/u/Chad_Retz)
#### Post date: [July 31, 2023, 5:24pm UTC](https://community.temporal.io/t/how-to-catch-activityerror-or-applicationerror-from-the-result-of-get-workflow-handle/9024/2 "2023-07-31T17:24:16Z")

</div>

The pasted snippet shows that `WorkflowFailureError` has a cause of `ActivityError` which has a cause of `ApplicationError`. You may get the cause of `WorkflowFailureError` with the `cause` property (which is just a friendly name for the built-in ` __cause__ ` attribute). And then you can get that one’s cause too. If you don’t want it wrapped in an `ActivityError`, you can catch and re-raise in the workflow with an `ApplicationError` directly. Note this error also lets you provide arbitrary objects as details which can be retrieved client side.

---

<div class="post-metadata">

### Author: ![netllama](https://avatars.discourse-cdn.com/v4/letter/n/ec9cab/32.png) [@netllama](https://community.temporal.io/u/netllama)
#### Post date: [July 31, 2023, 6:05pm UTC](https://community.temporal.io/t/how-to-catch-activityerror-or-applicationerror-from-the-result-of-get-workflow-handle/9024/3 "2023-07-31T18:05:17Z")

</div>

Ah, thanks, I see now. If I catch `WorkflowFailureError` as `err` then I can get the actual `ApplicationError` message via `err.cause.cause.message`
