@temporalio/client
Version:
Temporal.io SDK Client sub-package
141 lines (140 loc) • 4.91 kB
TypeScript
import type { ServiceError as GrpcServiceError } from '@grpc/grpc-js';
import type { RetryState } from '@temporalio/common';
/**
* Generic Error class for errors coming from the service
*/
export declare class ServiceError extends Error {
readonly cause?: Error;
constructor(message: string, opts?: {
cause: Error;
});
}
/**
* Thrown by the client while waiting on Workflow execution result if execution
* completes with failure.
*
* The failure type will be set in the `cause` attribute.
*
* For example if the workflow is cancelled, `cause` will be set to
* {@link CancelledFailure}.
*/
export declare class WorkflowFailedError extends Error {
readonly cause: Error | undefined;
readonly retryState: RetryState;
constructor(message: string, cause: Error | undefined, retryState: RetryState);
}
/**
* Thrown by the client while waiting on Workflow Update result if Update
* completes with failure.
*/
export declare class WorkflowUpdateFailedError extends Error {
readonly cause: Error | undefined;
constructor(message: string, cause: Error | undefined);
}
/**
* Thrown by the client if the Update call timed out or was cancelled.
* This doesn't mean the update itself was timed out or cancelled.
*/
export declare class WorkflowUpdateRPCTimeoutOrCancelledError extends Error {
readonly cause?: Error;
constructor(message: string, opts?: {
cause: Error;
});
}
/**
* Thrown the by client while waiting on Workflow execution result if Workflow
* continues as new.
*
* Only thrown if asked not to follow the chain of execution (see {@link WorkflowOptions.followRuns}).
*/
export declare class WorkflowContinuedAsNewError extends Error {
readonly newExecutionRunId: string;
constructor(message: string, newExecutionRunId: string);
}
/**
* Thrown when the requested Activity could not be found.
*/
export declare class ActivityNotFoundError extends Error {
}
/**
* Thrown by {@link AsyncCompletionClient} when trying to complete or heartbeat
* an Activity for any reason apart from {@link ActivityNotFoundError}.
*/
export declare class ActivityCompletionError extends Error {
}
/**
* Thrown by {@link AsyncCompletionClient.heartbeat} when the Workflow has
* requested to cancel the reporting Activity.
*/
export declare class ActivityCancelledError extends Error {
}
/**
* Thrown by {@link AsyncCompletionClient.heartbeat} when the reporting Activity
* has been paused.
*/
export declare class ActivityPausedError extends Error {
}
/**
* Thrown by {@link AsyncCompletionClient.heartbeat} when the reporting Activity
* has been reset.
*/
export declare class ActivityResetError extends Error {
}
/**
* Thrown by the {@link ActivityClient} while waiting on Activity execution result if execution completes with failure.
* The failure is stored in the `cause` property.
*
* @experimental Standalone Activities are experimental. APIs may be subject to change.
*/
export declare class ActivityExecutionFailedError extends Error {
readonly cause: Error | undefined;
readonly activityId: string;
readonly runId?: string | undefined;
constructor(message: string, cause: Error | undefined, activityId: string, runId?: string | undefined);
}
/**
* Thrown when starting an Activity failed because another Activity with the same ID already exists and reusing the ID
* is not allowed under chosen ID reuse policy and ID conflict policy. See {@link ActivityOptions.idReusePolicy} and
* {@link ActivityOptions.idConflictPolicy}.
*
* @experimental Standalone Activities are experimental. APIs may be subject to change.
*/
export declare class ActivityExecutionAlreadyStartedError extends Error {
/**
* ID of the Activity that failed to start.
*/
readonly activityId: string;
/**
* Run ID of the existing Activity execution with the same Activity ID.
*/
readonly runId: string;
constructor(message: string,
/**
* ID of the Activity that failed to start.
*/
activityId: string,
/**
* Run ID of the existing Activity execution with the same Activity ID.
*/
runId: string);
}
/**
* Returns true if the provided error is a {@link GrpcServiceError}.
*/
export declare function isGrpcServiceError(err: unknown): err is GrpcServiceError;
/**
* Returns true if the provided error or its cause is a {@link GrpcServiceError} with code DEADLINE_EXCEEDED.
*
* @see {@link Connection.withDeadline}
*/
export declare function isGrpcDeadlineError(err: unknown): err is Error;
/**
* Returns true if the provided error or its cause is a {@link GrpcServiceError} with code CANCELLED.
*
* @see {@link Connection.withAbortSignal}
*/
export declare function isGrpcCancelledError(err: unknown): err is Error;
/**
* @deprecated Use `isGrpcServiceError` instead
*/
export declare const isServerErrorResponse: typeof isGrpcServiceError;