Skip to content

Commit b6769ea

Browse files
authored
Merge pull request #71 from tornado-ssy/main-env0620
[fix] add types of errors
2 parents 8955107 + 519c5e9 commit b6769ea

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

Diff for: discovery/error.go

+26-23
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const (
2727
const (
2828
ErrInvalidParams int32 = 400001
2929
ErrUnhealthy int32 = 400002
30+
ErrUnregistryedEnv int32 = 400004
3031
ErrServiceAlreadyExists int32 = 400010
3132
ErrServiceNotExists int32 = 400012
3233
ErrDeployedInstance int32 = 400013
@@ -55,29 +56,31 @@ const (
5556
)
5657

5758
var errorsMap = map[int32]string{
58-
ErrInvalidParams: "Invalid parameter(s)",
59-
ErrUnhealthy: "Server is Unhealthy",
60-
ErrServiceAlreadyExists: "Micro-service already exists",
61-
ErrServiceNotExists: "Micro-service does not exist",
62-
ErrServiceVersionNotExists: "Micro-service version does not exist",
63-
ErrDeployedInstance: "Micro-service has deployed instance(s)",
64-
ErrDependedOnConsumer: "Consumer(s) depends on this micro-service",
65-
ErrUndefinedSchemaID: "Undefined schema id",
66-
ErrModifySchemaNotAllow: "Not allowed to modify schema",
67-
ErrSchemaNotExists: "Schema does not exist",
68-
ErrInstanceNotExists: "Instance does not exist",
69-
ErrPermissionDeny: "Access micro-service refused",
70-
ErrTagNotExists: "Tag does not exist",
71-
ErrRuleAlreadyExists: "Rule already exist",
72-
ErrBlackAndWhiteRule: "Can not have both 'BLACK' and 'WHITE'",
73-
ErrModifyRuleNotAllow: "Not allowed to modify the type of the rule",
74-
ErrRuleNotExists: "Rule does not exist",
75-
ErrNotEnoughQuota: "Not enough quota",
76-
ErrInternal: "Internal server error",
77-
ErrUnavailableBackend: "Registry service is unavailable",
78-
ErrUnavailableQuota: "Quota service is unavailable",
79-
ErrEndpointAlreadyExists: "Endpoint is already belong to other service",
80-
ErrForbidden: "Forbidden",
59+
ErrInvalidParams: "Invalid parameter(s)",
60+
ErrUnhealthy: "Server is Unhealthy",
61+
ErrServiceAlreadyExists: "Micro-service already exists",
62+
ErrServiceNotExists: "Micro-service does not exist",
63+
ErrServiceVersionNotExists: "Micro-service version does not exist",
64+
ErrDeployedInstance: "Micro-service has deployed instance(s)",
65+
ErrDependedOnConsumer: "Consumer(s) depends on this micro-service",
66+
ErrUndefinedSchemaID: "Undefined schema id",
67+
ErrModifySchemaNotAllow: "Not allowed to modify schema",
68+
ErrSchemaNotExists: "Schema does not exist",
69+
ErrInstanceNotExists: "Instance does not exist",
70+
ErrPermissionDeny: "Access micro-service refused",
71+
ErrTagNotExists: "Tag does not exist",
72+
ErrRuleAlreadyExists: "Rule already exist",
73+
ErrBlackAndWhiteRule: "Can not have both 'BLACK' and 'WHITE'",
74+
ErrModifyRuleNotAllow: "Not allowed to modify the type of the rule",
75+
ErrRuleNotExists: "Rule does not exist",
76+
ErrNotEnoughQuota: "Not enough quota",
77+
ErrInternal: "Internal server error",
78+
ErrUnavailableBackend: "Registry service is unavailable",
79+
ErrUnavailableQuota: "Quota service is unavailable",
80+
ErrEndpointAlreadyExists: "Endpoint is already belong to other service",
81+
ErrForbidden: "Forbidden",
82+
ErrUnregistryedEnv: "Env has services",
83+
ErrEnvironmentAlreadyExists: "EnvId already exist",
8184
}
8285

8386
var errManager = errsvc.NewManager()

0 commit comments

Comments
 (0)