Skip to content

Commit

Permalink
Merge branch 'master' into internal-types-lint-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Oct 29, 2020
2 parents 203980e + 2bb5d47 commit 51910f6
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This is a basic workflow to help you get started with Actions

name: Publish Docker image

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
release:
types: [ published ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
push_server_to_registry:
name: Push Docker server image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub (server build)
if: "!github.event.release.prerelease"
uses: docker/build-push-action@v1
with:
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }}
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }}
repository: ubercadence/server
build_args: TARGET=server
tag_with_ref: true
push_server_auto_setup_to_registry:
name: Push Docker server auto-setup images to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub (auto-setup build)
if: "!github.event.release.prerelease"
uses: docker/build-push-action@v1
with:
username: ${{ secrets.CADENCE_SERVER_DOCKERHUB_USERNAME }}
password: ${{ secrets.CADENCE_SERVER_DOCKERHUB_TOKEN }}
repository: ubercadence/server
build_args: TARGET=auto-setup
tags: ${{ github.event.release.tag_name }}-auto-setup, latestRelease-auto-setup
49 changes: 48 additions & 1 deletion common/types/mapper/thrift/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

package thrift

import "github.com/uber/cadence/common/types"
import (
"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common/types"
)

// FromError convert error to Thrift type if it comes as its internal equivalent
func FromError(err error) error {
Expand Down Expand Up @@ -65,3 +68,47 @@ func FromError(err error) error {
return err
}
}

// ToError convert error to internal type if it comes as its thrift equivalent
func ToError(err error) error {
if err == nil {
return nil
}

switch e := err.(type) {
case *shared.AccessDeniedError:
return ToAccessDeniedError(e)
case *shared.BadRequestError:
return ToBadRequestError(e)
case *shared.CancellationAlreadyRequestedError:
return ToCancellationAlreadyRequestedError(e)
case *shared.ClientVersionNotSupportedError:
return ToClientVersionNotSupportedError(e)
case *shared.CurrentBranchChangedError:
return ToCurrentBranchChangedError(e)
case *shared.DomainAlreadyExistsError:
return ToDomainAlreadyExistsError(e)
case *shared.DomainNotActiveError:
return ToDomainNotActiveError(e)
case *shared.EntityNotExistsError:
return ToEntityNotExistsError(e)
case *shared.InternalDataInconsistencyError:
return ToInternalDataInconsistencyError(e)
case *shared.InternalServiceError:
return ToInternalServiceError(e)
case *shared.LimitExceededError:
return ToLimitExceededError(e)
case *shared.QueryFailedError:
return ToQueryFailedError(e)
case *shared.RemoteSyncMatchedError:
return ToRemoteSyncMatchedError(e)
case *shared.RetryTaskV2Error:
return ToRetryTaskV2Error(e)
case *shared.ServiceBusyError:
return ToServiceBusyError(e)
case *shared.WorkflowExecutionAlreadyStartedError:
return ToWorkflowExecutionAlreadyStartedError(e)
default:
return err
}
}

0 comments on commit 51910f6

Please sign in to comment.