# Is throwing Workflow.wrap from a query method bad practive?

**URL:** <https://community.temporal.io/t/is-throwing-workflow-wrap-from-a-query-method-bad-practive/19778>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [August 18, 2026, 5:00pm UTC](https://community.temporal.io/t/is-throwing-workflow-wrap-from-a-query-method-bad-practive/19778 "2026-08-18T17:00:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew.sch](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@andrew.sch](https://community.temporal.io/u/andrew.sch)\
**Post date:** [August 18, 2026, 5:00pm UTC](https://community.temporal.io/t/is-throwing-workflow-wrap-from-a-query-method-bad-practive/19778/1 "2026-08-18T17:00:16Z")

</div>

For the past 4 years I have had a query method that would throw an exception with Workflow.Wrap(). I was then able to catch the exception from my api where I called the query method using the java sdk. Today I am testing upgrading to a newer temporal version and I am seeing the querymethod retry after throwing the exception indefinitely until my server timesout. Has something changed that is causing this and do you have a suggestion to solve this?

Here is a simplified version of the querymethod

```auto
@QueryMethod
public Response queryMethod(){
   if(condition){
      return response;
   } 
   throw Workflow.wrap(new DetailedException);
}

Api
try{
   stub.queryMethod() //hangs here while the queryMethod retries forever
} catch(Exception e){
   // Use to return here right away
}

```

Thank you for your help

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [August 19, 2026, 9:56pm UTC](https://community.temporal.io/t/is-throwing-workflow-wrap-from-a-query-method-bad-practive/19778/2 "2026-08-19T21:56:42Z")

</div>

workflow update has replaced need to poll via workflow query
