From fc0d00eb5369cca059fa826bd5afc47f1fdecb81 Mon Sep 17 00:00:00 2001 From: Quanzheng Long Date: Fri, 15 Nov 2024 12:52:10 -0800 Subject: [PATCH] Jira/iwf 273 Add/fix javadocs for exception thrown (#265) --- src/main/java/io/iworkflow/core/Client.java | 96 ++++++++++++++++--- src/main/java/io/iworkflow/core/Context.java | 21 +++- src/main/java/io/iworkflow/core/RPC.java | 1 + .../java/io/iworkflow/core/StateDecision.java | 2 +- .../java/io/iworkflow/core/WorkerService.java | 1 + .../core/communication/Communication.java | 3 +- .../NoRunningWorkflowException.java | 7 +- .../WorkflowNotExistsException.java | 14 +++ .../WorkflowNotExistsOrOpenException.java | 14 --- 9 files changed, 125 insertions(+), 34 deletions(-) create mode 100644 src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsException.java delete mode 100644 src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsOrOpenException.java diff --git a/src/main/java/io/iworkflow/core/Client.java b/src/main/java/io/iworkflow/core/Client.java index ffd5740b..32370aa9 100644 --- a/src/main/java/io/iworkflow/core/Client.java +++ b/src/main/java/io/iworkflow/core/Client.java @@ -1,5 +1,9 @@ package io.iworkflow.core; +import io.iworkflow.core.exceptions.LongPollTimeoutException; +import io.iworkflow.core.exceptions.NoRunningWorkflowException; +import io.iworkflow.core.exceptions.WorkflowAlreadyStartedException; +import io.iworkflow.core.exceptions.WorkflowNotExistsException; import io.iworkflow.core.mapper.StateMovementMapper; import io.iworkflow.core.persistence.PersistenceOptions; import io.iworkflow.gen.models.ErrorSubStatus; @@ -65,6 +69,7 @@ public UnregisteredClient getUnregisteredClient() { * @param workflowId is required * @param workflowTimeoutSeconds is required * @return runId + * @throws WorkflowAlreadyStartedException if the workflow is already started */ public String startWorkflow( final Class workflowClass, @@ -81,6 +86,7 @@ public String startWorkflow( * @param workflowTimeoutSeconds is required * @param input is optional, can be null * @return runId + * @throws WorkflowAlreadyStartedException if the workflow is already started */ public String startWorkflow( final Class workflowClass, @@ -99,6 +105,10 @@ public String startWorkflow( * @param input is optional, can be null * @param option is optional, can be null * @return runId + * @throws WorkflowAlreadyStartedException if the workflow is already started. + * If using WorkflowAlreadyStartedOptions in WorkflowOptions, the error will be ignored if ignoreAlreadyStartedError is true. + * If ignoreAlreadyStartedError is true and also requestId is set, the requestId will be used to identify the request. The error + * will only be thrown if the requestId is different from the requestId of the existing workflow. */ public String startWorkflow( final Class workflowClass, @@ -119,6 +129,10 @@ public String startWorkflow( * @param input is optional, can be null * @param options is optional, can be null * @return runId + * @throws WorkflowAlreadyStartedException if the workflow is already started. + * If using WorkflowAlreadyStartedOptions in WorkflowOptions, the error will be ignored if ignoreAlreadyStartedError is true. + * If ignoreAlreadyStartedError is true and also requestId is set, the requestId will be used to identify the request. The error + * will only be thrown if the requestId is different from the requestId of the existing workflow. */ public String startWorkflow( final String wfType, @@ -278,9 +292,11 @@ private List convertToSearchAttributeList(final Map type of the output * @return the output result + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing + * @throws LongPollTimeoutException if the long poll timeout */ public T waitForWorkflowCompletion( final Class valueClass, @@ -308,6 +327,14 @@ public T waitForWorkflowCompletion( /** * Use {@link #waitForWorkflowCompletion(Class, String)} instead * It's just a renaming. + * @param type of the output + * @param valueClass required, the type class of the output + * @param workflowId required, the workflowId + * @param workflowRunId optional, can be empty + * @return the output result + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing + * @throws LongPollTimeoutException if the long poll timeout */ @Deprecated public T getSimpleWorkflowResultWithWait( @@ -320,6 +347,13 @@ public T getSimpleWorkflowResultWithWait( /** * Use {@link #waitForWorkflowCompletion(Class, String)} instead * It's just a renaming. + * @param type of the output + * @param valueClass required, the type class of the output + * @param workflowId required, the workflowId + * @return the output result + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing + * @throws LongPollTimeoutException if the long poll timeout */ @Deprecated public T getSimpleWorkflowResultWithWait( @@ -331,14 +365,14 @@ public T getSimpleWorkflowResultWithWait( /** * For most cases, a workflow only has one result(one completion state). * Use this API to retrieve the output of the state without waiting for the workflow to complete. - * If the workflow is not COMPLETED, throw the {@link WorkflowUncompletedException}. - * Else, return the same result as {@link #getSimpleWorkflowResultWithWait(Class, String, String)}. * * @param valueClass required, the type class of the output * @param workflowId required, the workflowId * @param workflowRunId optional, can be empty * @param type of the output * @return the output result + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing */ public T tryGettingSimpleWorkflowResult( final Class valueClass, @@ -350,13 +384,13 @@ public T tryGettingSimpleWorkflowResult( /** * For most cases, a workflow only has one result(one completion state). * Use this API to retrieve the output of the state without waiting for the workflow to complete. - * If the workflow is not COMPLETED, throw the {@link WorkflowUncompletedException}. - * Else, return the same result as {@link #getSimpleWorkflowResultWithWait(Class, String)}. * * @param valueClass required, the type class of the output * @param workflowId required, the workflowId * @param type of the output * @return the output result + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing */ public T tryGettingSimpleWorkflowResult( final Class valueClass, @@ -367,11 +401,13 @@ public T tryGettingSimpleWorkflowResult( /** * In some cases, a workflow may have more than one completion states. * Use this API to retrieve the output of the states with waiting for the workflow to complete. - * If the workflow is not COMPLETED, throw the {@link feign.FeignException.FeignClientException}. * * @param workflowId required, the workflowId * @param workflowRunId optional, can be empty * @return a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing + * @throws LongPollTimeoutException if the long poll timeout */ public List getComplexWorkflowResultWithWait( final String workflowId, final String workflowRunId) { @@ -381,10 +417,12 @@ public List getComplexWorkflowResultWithWait( /** * In some cases, a workflow may have more than one completion states. * Use this API to retrieve the output of the states with waiting for the workflow to complete. - * If the workflow is not COMPLETED, throw the {@link feign.FeignException.FeignClientException}. * * @param workflowId required, the workflowId * @return a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing + * @throws LongPollTimeoutException if the long poll timeout */ public List getComplexWorkflowResultWithWait(final String workflowId) { return getComplexWorkflowResultWithWait(workflowId, ""); @@ -393,12 +431,12 @@ public List getComplexWorkflowResultWithWait(final String /** * In some cases, a workflow may have more than one completion states. * Use this API to retrieve the output of the states without waiting for the workflow to complete. - * If the workflow is not COMPLETED, throw the {@link WorkflowUncompletedException}. - * Else, return the same result as {@link #getComplexWorkflowResultWithWait(String, String)}. * * @param workflowId required, the workflowId * @param workflowRunId optional, can be empty * @return a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing */ public List tryGettingComplexWorkflowResult( final String workflowId, final String workflowRunId) { @@ -408,11 +446,11 @@ public List tryGettingComplexWorkflowResult( /** * In some cases, a workflow may have more than one completion states. * Use this API to retrieve the output of the states without waiting for the workflow to complete. - * If the workflow is not COMPLETED, throw the {@link WorkflowUncompletedException}. - * Else, return the same result as {@link #getComplexWorkflowResultWithWait(String)}. * * @param workflowId required, the workflowId * @return a list of the state output for completion states. User code will figure how to use ObjectEncoder to decode the output + * @throws WorkflowUncompletedException if the workflow is not COMPLETED + * @throws WorkflowNotExistsException if the workflow is not existing */ public List tryGettingComplexWorkflowResult(final String workflowId) { return tryGettingComplexWorkflowResult(workflowId, ""); @@ -426,6 +464,7 @@ public List tryGettingComplexWorkflowResult(final String * @param workflowRunId optional, can be empty * @param signalChannelName required * @param signalValue optional, can be null + * @throws NoRunningWorkflowException if the workflow is not existing or not running */ public void signalWorkflow( final Class workflowClass, @@ -453,6 +492,7 @@ public void signalWorkflow( * @param workflowId required * @param signalChannelName required * @param signalValue optional, can be null + * @throws NoRunningWorkflowException if the workflow is not existing or not running */ public void signalWorkflow( final Class workflowClass, @@ -467,6 +507,7 @@ public void signalWorkflow( * @param workflowRunId optional, can be empty * @param resetWorkflowTypeAndOptions required, the combination parameter for reset * @return the new runId after reset + * @throws WorkflowNotExistsException if the workflow is not existing */ public String resetWorkflow( final String workflowId, @@ -480,6 +521,7 @@ public String resetWorkflow( * @param workflowId required * @param resetWorkflowTypeAndOptions required, the combination parameter for reset * @return the new runId after reset + * @throws WorkflowNotExistsException if the workflow is not existing */ public String resetWorkflow( final String workflowId, @@ -494,6 +536,7 @@ public String resetWorkflow( * @param workflowId required * @param workflowRunId optional, can be empty * @param options optional, can be null. If not set, the workflow status will be CANCELED + * @throws NoRunningWorkflowException if the workflow is not existing or not running */ public void stopWorkflow( final String workflowId, @@ -507,6 +550,7 @@ public void stopWorkflow( * * @param workflowId required * @param options optional, can be null. If not set, the workflow status will be CANCELED + * @throws NoRunningWorkflowException if the workflow is not existing or not running */ public void stopWorkflow( final String workflowId, @@ -519,6 +563,7 @@ public void stopWorkflow( * The workflow status will be CANCELED * * @param workflowId required + * @throws NoRunningWorkflowException if the workflow is not existing or not running */ public void stopWorkflow(final String workflowId) { stopWorkflow(workflowId, "", null); @@ -532,6 +577,7 @@ public void stopWorkflow(final String workflowId) { * @param workflowRunId optional, can be empty * @param keys required, cannot be empty or null * @return the data attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getWorkflowDataAttributes( final Class workflowClass, @@ -552,6 +598,7 @@ public Map getWorkflowDataAttributes( * @param workflowId required * @param keys required, cannot be empty or null * @return the data attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getWorkflowDataAttributes( final Class workflowClass, @@ -567,6 +614,7 @@ public Map getWorkflowDataAttributes( * @param workflowId required * @param workflowRunId optional, can be empty * @return the data attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getAllDataAttributes( final Class workflowClass, @@ -581,6 +629,7 @@ public Map getAllDataAttributes( * @param workflowClass required * @param workflowId required * @return the data attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getAllDataAttributes( final Class workflowClass, @@ -643,6 +692,7 @@ private Map doGetWorkflowDataAttributes( * @param workflowId required * @param workflowRunId optional, can be empty * @param dataAttributes required + * @throws NoRunningWorkflowException if the workflow is not existing or not running * */ public void setWorkflowDataAttributes( final Class workflowClass, @@ -658,6 +708,7 @@ public void setWorkflowDataAttributes( * @param workflowClass required * @param workflowId required * @param dataAttributes required + * @throws NoRunningWorkflowException if the workflow is not existing or not running * */ public void setWorkflowDataAttributes( final Class workflowClass, @@ -787,6 +838,7 @@ public T newRpcStub(Class workflowClassForRpc, String workflowId) { * @param the input type * @param the output type * @return output + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public O invokeRPC(RpcDefinitions.RpcFunc1 rpcStubMethod, I input) { return rpcStubMethod.execute(null, input, null, null); @@ -800,6 +852,7 @@ public O invokeRPC(RpcDefinitions.RpcFunc1 rpcStubMethod, I input) * @param the input type * @param the output type * @return output + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public O invokeRPC(RpcDefinitions.RpcFunc1NoPersistence rpcStubMethod, I input) { return rpcStubMethod.execute(null, input, null); @@ -811,6 +864,7 @@ public O invokeRPC(RpcDefinitions.RpcFunc1NoPersistence rpcStubMeth * @param rpcStubMethod the RPC method from stub created by {@link #newRpcStub(Class, String, String)} * @param the output type * @return output + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public O invokeRPC(RpcDefinitions.RpcFunc0 rpcStubMethod) { return rpcStubMethod.execute(null, null, null); @@ -822,6 +876,7 @@ public O invokeRPC(RpcDefinitions.RpcFunc0 rpcStubMethod) { * @param rpcStubMethod the RPC method from stub created by {@link #newRpcStub(Class, String, String)} * @param the output type * @return output + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public O invokeRPC(RpcDefinitions.RpcFunc0NoPersistence rpcStubMethod) { return rpcStubMethod.execute(null, null); @@ -833,6 +888,7 @@ public O invokeRPC(RpcDefinitions.RpcFunc0NoPersistence rpcStubMethod) { * @param rpcStubMethod the RPC method from stub created by {@link #newRpcStub(Class, String, String)} * @param input the input of the RPC method * @param the input type + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public void invokeRPC(RpcDefinitions.RpcProc1 rpcStubMethod, I input) { rpcStubMethod.execute(null, input, null, null); @@ -844,6 +900,7 @@ public void invokeRPC(RpcDefinitions.RpcProc1 rpcStubMethod, I input) { * @param rpcStubMethod the RPC method from stub created by {@link #newRpcStub(Class, String, String)} * @param input the input of the RPC method * @param the input type + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public void invokeRPC(RpcDefinitions.RpcProc1NoPersistence rpcStubMethod, I input) { rpcStubMethod.execute(null, input, null); @@ -853,6 +910,7 @@ public void invokeRPC(RpcDefinitions.RpcProc1NoPersistence rpcStubMethod, * invoking the RPC through RPC stub * * @param rpcStubMethod the RPC method from stub created by {@link #newRpcStub(Class, String, String)} + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public void invokeRPC(RpcDefinitions.RpcProc0 rpcStubMethod) { rpcStubMethod.execute(null, null, null); @@ -862,6 +920,7 @@ public void invokeRPC(RpcDefinitions.RpcProc0 rpcStubMethod) { * invoking the RPC through RPC stub * * @param rpcStubMethod the RPC method from stub created by {@link #newRpcStub(Class, String, String)} + * @throws WorkflowNotExistsException if the workflow is not existing, or not running to accept a write operation in RPC */ public void invokeRPC(RpcDefinitions.RpcProc0NoPersistence rpcStubMethod) { rpcStubMethod.execute(null, null); @@ -875,6 +934,7 @@ public void invokeRPC(RpcDefinitions.RpcProc0NoPersistence rpcStubMethod) { * @param workflowRunId optional, can be empty * @param attributeKeys required, cannot be empty or null * @return the search attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getWorkflowSearchAttributes( final Class workflowClass, @@ -894,6 +954,7 @@ public Map getWorkflowSearchAttributes( * @param workflowId required * @param attributeKeys required, cannot be empty or null * @return the search attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getWorkflowSearchAttributes( final Class workflowClass, @@ -909,6 +970,7 @@ public Map getWorkflowSearchAttributes( * @param workflowId required * @param workflowRunId optional, can be empty * @return the search attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getAllSearchAttributes( final Class workflowClass, @@ -924,6 +986,7 @@ public Map getAllSearchAttributes( * @param workflowClass required * @param workflowId required * @param searchAttributes required + * @throws NoRunningWorkflowException if the workflow is not existing or not running * */ public void setWorkflowSearchAttributes( final Class workflowClass, @@ -939,6 +1002,7 @@ public void setWorkflowSearchAttributes( * @param workflowId required * @param workflowRunId optional, can be empty * @param searchAttributes required + * @throws NoRunningWorkflowException if the workflow is not existing or not running * */ public void setWorkflowSearchAttributes( final Class workflowClass, @@ -954,6 +1018,7 @@ public void setWorkflowSearchAttributes( * @param workflowClass required * @param workflowId required * @return the search attributes + * @throws WorkflowNotExistsException if the workflow is not existing */ public Map getAllSearchAttributes( final Class workflowClass, @@ -968,6 +1033,7 @@ public Map getAllSearchAttributes( * @param workflowId required * @param workflowRunId optional, can be empty * @return the workflow's info + * @throws WorkflowNotExistsException if the workflow is not existing */ public WorkflowInfo describeWorkflow( final String workflowId, @@ -984,6 +1050,7 @@ public WorkflowInfo describeWorkflow( * * @param workflowId required * @return the workflow's info + * @throws WorkflowNotExistsException if the workflow is not existing */ public WorkflowInfo describeWorkflow( final String workflowId) { @@ -1127,9 +1194,10 @@ public void skipTimer( * A long poll API to wait for the completion of the state. This only waits for the first completion. * Note 1 The stateCompletion to wait for is needed to registered on starting workflow due to limitation in https://github.com/indeedeng/iwf/issues/349 * Note 2 The max polling time is configured as clientOptions as the Feign client timeout(default to 10s) - * If the state is not COMPLETED, throw the {@link ClientSideException} with the sub status of {@link ErrorSubStatus#LONG_POLL_TIME_OUT_SUB_STATUS} * @param workflowId the workflowId * @param stateClass the state class. + * @throws LongPollTimeoutException if the long poll timeout + * @throws WorkflowNotExistsException if the workflow is not existing */ public void waitForStateExecutionCompletion( final String workflowId, @@ -1145,6 +1213,8 @@ public void waitForStateExecutionCompletion( * @param workflowId the workflowId * @param stateClass the state class * @param waitForKey key provided by the client and to identity workflow + * @throws LongPollTimeoutException if the long poll timeout + * @throws WorkflowNotExistsException if the workflow is not existing */ public void waitForStateExecutionCompletion( final String workflowId, @@ -1162,6 +1232,8 @@ public void waitForStateExecutionCompletion( * @param workflowId the workflowId * @param stateClass the state class * @param stateExecutionNumber the state execution number. E.g. if it's 2, it means the 2nd execution of the state + * @throws LongPollTimeoutException if the long poll timeout + * @throws WorkflowNotExistsException if the workflow is not existing */ public void waitForStateExecutionCompletion( final String workflowId, diff --git a/src/main/java/io/iworkflow/core/Context.java b/src/main/java/io/iworkflow/core/Context.java index 01a7e549..e4dbd9da 100644 --- a/src/main/java/io/iworkflow/core/Context.java +++ b/src/main/java/io/iworkflow/core/Context.java @@ -8,6 +8,10 @@ public abstract class Context { public abstract Long getWorkflowStartTimestampSeconds(); + /** + * @return the StateExecutionId. + * Only applicable for state methods (waitUntil or execute) + */ public abstract Optional getStateExecutionId(); public abstract String getWorkflowRunId(); @@ -16,11 +20,20 @@ public abstract class Context { public abstract String getWorkflowType(); - // this is the start time of the first attempt of the API call. It's from ScheduledTimestamp of Cadence/Temporal activity.GetInfo - // require server version 1.2.2+, return -1 if server version is lower + /** + * @return the start time of the first attempt of the state method invocation. + * Only applicable for state methods (waitUntil or execute) + */ public abstract Optional getFirstAttemptTimestampSeconds(); - // Attempt starts from 1, and increased by 1 for every retry if retry policy is specified. It's from Attempt of Cadence/Temporal activity.GetInfo - // require server version 1.2.2+, return -1 if server version is lower + /** + * @return attempt starts from 1, and increased by 1 for every retry if retry policy is specified. + */ public abstract Optional getAttempt(); + + /** + * @return the requestId that is used to start the child workflow from state method. + * Only applicable for state methods (waitUntil or execute) + */ + public abstract Optional getChildWorkflowRequestId(); } diff --git a/src/main/java/io/iworkflow/core/RPC.java b/src/main/java/io/iworkflow/core/RPC.java index c85da78f..f8c921fc 100644 --- a/src/main/java/io/iworkflow/core/RPC.java +++ b/src/main/java/io/iworkflow/core/RPC.java @@ -38,6 +38,7 @@ * Only used when workflow has enabled {@link PersistenceOptions} CachingPersistenceByMemo * By default, it's false for high throughput support * flip to true to bypass the caching for strong consistent reads + * @return true if bypass caching for strong consistency */ boolean bypassCachingForStrongConsistency() default false; } \ No newline at end of file diff --git a/src/main/java/io/iworkflow/core/StateDecision.java b/src/main/java/io/iworkflow/core/StateDecision.java index bd8c9276..aad6c674 100644 --- a/src/main/java/io/iworkflow/core/StateDecision.java +++ b/src/main/java/io/iworkflow/core/StateDecision.java @@ -182,7 +182,7 @@ public static StateDecision singleNextState(final Class stateClass, final Object stateInput) { return singleNextState(stateClass.getSimpleName(), stateInput, null); diff --git a/src/main/java/io/iworkflow/core/WorkerService.java b/src/main/java/io/iworkflow/core/WorkerService.java index ff4e2698..ee8c8e30 100644 --- a/src/main/java/io/iworkflow/core/WorkerService.java +++ b/src/main/java/io/iworkflow/core/WorkerService.java @@ -388,6 +388,7 @@ private Context fromIdlContext(final io.iworkflow.gen.models.Context context, fi .workflowRunId(context.getWorkflowRunId()) .workflowStartTimestampSeconds(context.getWorkflowStartedTimestamp()) .stateExecutionId(Optional.ofNullable(context.getStateExecutionId())) + .childWorkflowRequestId(context.getWorkflowRunId()+"-"+context.getStateExecutionId()) .attempt(attempt) .firstAttemptTimestampSeconds(firstAttemptTimestamp) .build(); diff --git a/src/main/java/io/iworkflow/core/communication/Communication.java b/src/main/java/io/iworkflow/core/communication/Communication.java index 748760d8..71d6ec8a 100644 --- a/src/main/java/io/iworkflow/core/communication/Communication.java +++ b/src/main/java/io/iworkflow/core/communication/Communication.java @@ -16,8 +16,7 @@ public interface Communication { * trigger new state movements as the RPC results * NOTE: closing workflows like completing/failing are not supported * NOTE: Only used in RPC -- cannot be used in state APIs - * - * @param stateMovements + * @param stateMovements the state movements to trigger */ void triggerStateMovements(final StateMovement... stateMovements); } diff --git a/src/main/java/io/iworkflow/core/exceptions/NoRunningWorkflowException.java b/src/main/java/io/iworkflow/core/exceptions/NoRunningWorkflowException.java index 6bd94c9d..f20a8f04 100644 --- a/src/main/java/io/iworkflow/core/exceptions/NoRunningWorkflowException.java +++ b/src/main/java/io/iworkflow/core/exceptions/NoRunningWorkflowException.java @@ -2,7 +2,12 @@ import io.iworkflow.core.ClientSideException; -public class NoRunningWorkflowException extends WorkflowNotExistsOrOpenException { +/** + * A friendly named exception to indicate that the workflow does not exist or exists but not running. + * It's the same as {@link WorkflowNotExistsException} but with a different name. + * It's subclass of {@link ClientSideException} with ErrorSubStatus.WORKFLOW_NOT_EXISTS_SUB_STATUS + */ +public class NoRunningWorkflowException extends WorkflowNotExistsException { public NoRunningWorkflowException( final ClientSideException exception) { super(exception); diff --git a/src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsException.java b/src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsException.java new file mode 100644 index 00000000..dd29852e --- /dev/null +++ b/src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsException.java @@ -0,0 +1,14 @@ +package io.iworkflow.core.exceptions; + +import io.iworkflow.core.ClientSideException; + +/** + * A friendly named exception to indicate that the workflow does not exist + * It's subclass of {@link ClientSideException} with ErrorSubStatus.WORKFLOW_NOT_EXISTS_SUB_STATUS + */ +public class WorkflowNotExistsException extends ClientSideException { + public WorkflowNotExistsException( + final ClientSideException exception) { + super(exception); + } +} diff --git a/src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsOrOpenException.java b/src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsOrOpenException.java deleted file mode 100644 index 94471233..00000000 --- a/src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsOrOpenException.java +++ /dev/null @@ -1,14 +0,0 @@ -package io.iworkflow.core.exceptions; - -import io.iworkflow.core.ClientSideException; - -/** - * @deprecated Use NoRunningWorkflowException instead - */ -@Deprecated -public class WorkflowNotExistsOrOpenException extends ClientSideException { - public WorkflowNotExistsOrOpenException( - final ClientSideException exception) { - super(exception); - } -}