You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2021/05/28 09:23:00 UTC
[incubator-inlong] 03/03: Use errs
This is an automated email from the ASF dual-hosted git repository.
gosonzhang pushed a commit to branch INLONG-25
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
commit 6fd764444c824cae9595a5551c2d7a7443a3e4e6
Author: Zijie Lu <ws...@gmail.com>
AuthorDate: Fri May 28 16:03:15 2021 +0800
Use errs
Signed-off-by: Zijie Lu <ws...@gmail.com>
---
tubemq-client-twins/tubemq-client-go/errs/errs.go | 2 ++
tubemq-client-twins/tubemq-client-go/selector/selector.go | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tubemq-client-twins/tubemq-client-go/errs/errs.go b/tubemq-client-twins/tubemq-client-go/errs/errs.go
index 0ef803d..00b3c81 100644
--- a/tubemq-client-twins/tubemq-client-go/errs/errs.go
+++ b/tubemq-client-twins/tubemq-client-go/errs/errs.go
@@ -33,6 +33,8 @@ const (
RetAssertionFailure = 4
// RetRequestFailure represents the error code of request error.
RetRequestFailure = 5
+ // RetSelectorNotExist = 6
+ RetSelectorNotExist = 6
)
// ErrAssertionFailure represents RetAssertionFailure error.
diff --git a/tubemq-client-twins/tubemq-client-go/selector/selector.go b/tubemq-client-twins/tubemq-client-go/selector/selector.go
index 77352fd..9d34be0 100644
--- a/tubemq-client-twins/tubemq-client-go/selector/selector.go
+++ b/tubemq-client-twins/tubemq-client-go/selector/selector.go
@@ -19,8 +19,9 @@
package selector
import (
- "errors"
"fmt"
+
+ "github.com/apache/incubator-inlong/tubemq-client-twins/tubemq-client-go/errs"
)
// Selector is abstraction of route selector which can return an available address
@@ -42,7 +43,7 @@ func Register(name string, s Selector) {
// Get returns the corresponding selector.
func Get(name string) (Selector, error) {
if _, ok := selectors[name]; !ok {
- return nil, errors.New(fmt.Sprintf("selector %s is invalid", name))
+ return nil, errs.New(errs.RetSelectorNotExist, fmt.Sprintf("selector %s is invalid", name))
}
return selectors[name], nil
}