Skip to content

Commit

Permalink
Fix typo in documentation (#1288)
Browse files Browse the repository at this point in the history
fix typo in documentation
  • Loading branch information
theleeeo authored Nov 8, 2023
1 parent 0e432a9 commit 4663bab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions temporal/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ Workflow code could handle errors based on different types of error. Below is sa
err := workflow.ExecuteActivity(ctx, MyActivity, ...).Get(ctx, nil)
if err != nil {
var applicationErr *ApplicationError
if errors.As(err, &applicationError) {
if errors.As(err, &applicationErr) {
// retrieve error message
fmt.Println(applicationError.Error())
fmt.Println(applicationErr.Error())
// handle activity errors (created via NewApplicationError() API)
var detailMsg string // assuming activity return error by NewApplicationError("message", true, "string details")
applicationErr.Details(&detailMsg) // extract strong typed details
// handle activity errors (errors created other than using NewApplicationError() API)
switch err.Type() {
switch applicationErr.Type() {
case "CustomErrTypeA":
// handle CustomErrTypeA
case CustomErrTypeB:
Expand All @@ -88,9 +88,11 @@ if err != nil {
var timeoutErr *TimeoutError
if errors.As(err, &timeoutErr) {
// handle timeout, could check timeout type by timeoutErr.TimeoutType()
switch err.TimeoutType() {
switch timeoutErr.TimeoutType() {
case enumspb.TIMEOUT_TYPE_SCHEDULE_TO_START:
// Handle ScheduleToStart timeout.
case enumspb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE:
// Handle ScheduleToClose timeout.
case enumspb.TIMEOUT_TYPE_START_TO_CLOSE:
// Handle StartToClose timeout.
case enumspb.TIMEOUT_TYPE_HEARTBEAT:
Expand Down

0 comments on commit 4663bab

Please sign in to comment.