-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
2,127 additions
and
812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,27 +51,24 @@ PROTO_GRPC_SERVICES = $(patsubst $(PROTO_OUT)/%,%,$(shell find $(PROTO_OUT) -nam | |
dir_no_slash = $(patsubst %/,%,$(dir $(1))) | ||
dirname = $(notdir $(call dir_no_slash,$(1))) | ||
|
||
grpc-mock: gobin-install | ||
grpc-mock: | ||
@echo "Generate gRPC mocks..." | ||
@$(foreach PROTO_GRPC_SERVICE,$(PROTO_GRPC_SERVICES),cd $(PROTO_OUT) && mockgen -package $(call dirname,$(PROTO_GRPC_SERVICE))mock -source $(PROTO_GRPC_SERVICE) -destination $(call dir_no_slash,$(PROTO_GRPC_SERVICE))mock/$(notdir $(PROTO_GRPC_SERVICE:go=mock.go)) ) | ||
|
||
# Plugins & tools | ||
|
||
grpc-install: gogo-protobuf-install | ||
echo "Installing/updaing gRPC plugins..." | ||
go get -u google.golang.org/grpc | ||
GO111MODULE=off go get -u google.golang.org/grpc | ||
|
||
gogo-protobuf-install: go-protobuf-install | ||
go get -u github.com/gogo/protobuf/protoc-gen-gogoslick | ||
GO111MODULE=off go get -u github.com/gogo/protobuf/protoc-gen-gogoslick | ||
|
||
go-protobuf-install: | ||
go get -u github.com/golang/protobuf/protoc-gen-go | ||
GO111MODULE=off go get -u github.com/golang/protobuf/protoc-gen-go | ||
|
||
gobin-install: | ||
GO111MODULE=off go get -u github.com/myitcv/gobin | ||
|
||
mockgen-install: gobin-install | ||
gobin -mod=readonly github.com/golang/mock/[email protected] | ||
mockgen-install: | ||
GO111MODULE=off go get -u github.com/golang/mock/mockgen | ||
|
||
# Add licence header to generated files | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2020 Temporal Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
package serviceerror | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gogo/status" | ||
"google.golang.org/grpc/codes" | ||
|
||
"go.temporal.io/temporal-proto/failure" | ||
) | ||
|
||
type ( | ||
// FeatureVersionNotSupported represents client version is not supported error. | ||
FeatureVersionNotSupported struct { | ||
Message string | ||
FeatureVersion string | ||
Feature string | ||
SupportedVersions string | ||
st *status.Status | ||
} | ||
) | ||
|
||
// NewFeatureVersionNotSupported returns new FeatureVersionNotSupported error. | ||
func NewFeatureVersionNotSupported(feature, featureVersion, supportedVersions string) *FeatureVersionNotSupported { | ||
return &FeatureVersionNotSupported{ | ||
Message: fmt.Sprintf("Feature %s is not supported in feature set version %s. At least %s feature set version is required", feature, featureVersion, supportedVersions), | ||
FeatureVersion: featureVersion, | ||
Feature: feature, | ||
SupportedVersions: supportedVersions, | ||
} | ||
} | ||
|
||
// Error returns string message. | ||
func (e *FeatureVersionNotSupported) Error() string { | ||
return e.Message | ||
} | ||
|
||
func (e *FeatureVersionNotSupported) status() *status.Status { | ||
if e.st != nil { | ||
return e.st | ||
} | ||
|
||
st := status.New(codes.FailedPrecondition, e.Message) | ||
st, _ = st.WithDetails( | ||
&failure.FeatureVersionNotSupported{ | ||
FeatureVersion: e.FeatureVersion, | ||
Feature: e.Feature, | ||
SupportedVersions: e.SupportedVersions, | ||
}, | ||
) | ||
return st | ||
} | ||
|
||
func newFeatureVersionNotSupported(st *status.Status, failure *failure.FeatureVersionNotSupported) *FeatureVersionNotSupported { | ||
return &FeatureVersionNotSupported{ | ||
Message: st.Message(), | ||
FeatureVersion: failure.FeatureVersion, | ||
Feature: failure.Feature, | ||
SupportedVersions: failure.SupportedVersions, | ||
st: st, | ||
} | ||
} |
Submodule temporal-proto
updated
from 83c25f to fdedde
Oops, something went wrong.