Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] add types of errors #71

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions discovery/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
const (
ErrInvalidParams int32 = 400001
ErrUnhealthy int32 = 400002
ErrUnregistryedEnv int32 = 400004
ErrServiceAlreadyExists int32 = 400010
ErrServiceNotExists int32 = 400012
ErrDeployedInstance int32 = 400013
Expand Down Expand Up @@ -55,29 +56,31 @@ const (
)

var errorsMap = map[int32]string{
ErrInvalidParams: "Invalid parameter(s)",
ErrUnhealthy: "Server is Unhealthy",
ErrServiceAlreadyExists: "Micro-service already exists",
ErrServiceNotExists: "Micro-service does not exist",
ErrServiceVersionNotExists: "Micro-service version does not exist",
ErrDeployedInstance: "Micro-service has deployed instance(s)",
ErrDependedOnConsumer: "Consumer(s) depends on this micro-service",
ErrUndefinedSchemaID: "Undefined schema id",
ErrModifySchemaNotAllow: "Not allowed to modify schema",
ErrSchemaNotExists: "Schema does not exist",
ErrInstanceNotExists: "Instance does not exist",
ErrPermissionDeny: "Access micro-service refused",
ErrTagNotExists: "Tag does not exist",
ErrRuleAlreadyExists: "Rule already exist",
ErrBlackAndWhiteRule: "Can not have both 'BLACK' and 'WHITE'",
ErrModifyRuleNotAllow: "Not allowed to modify the type of the rule",
ErrRuleNotExists: "Rule does not exist",
ErrNotEnoughQuota: "Not enough quota",
ErrInternal: "Internal server error",
ErrUnavailableBackend: "Registry service is unavailable",
ErrUnavailableQuota: "Quota service is unavailable",
ErrEndpointAlreadyExists: "Endpoint is already belong to other service",
ErrForbidden: "Forbidden",
ErrInvalidParams: "Invalid parameter(s)",
ErrUnhealthy: "Server is Unhealthy",
ErrServiceAlreadyExists: "Micro-service already exists",
ErrServiceNotExists: "Micro-service does not exist",
ErrServiceVersionNotExists: "Micro-service version does not exist",
ErrDeployedInstance: "Micro-service has deployed instance(s)",
ErrDependedOnConsumer: "Consumer(s) depends on this micro-service",
ErrUndefinedSchemaID: "Undefined schema id",
ErrModifySchemaNotAllow: "Not allowed to modify schema",
ErrSchemaNotExists: "Schema does not exist",
ErrInstanceNotExists: "Instance does not exist",
ErrPermissionDeny: "Access micro-service refused",
ErrTagNotExists: "Tag does not exist",
ErrRuleAlreadyExists: "Rule already exist",
ErrBlackAndWhiteRule: "Can not have both 'BLACK' and 'WHITE'",
ErrModifyRuleNotAllow: "Not allowed to modify the type of the rule",
ErrRuleNotExists: "Rule does not exist",
ErrNotEnoughQuota: "Not enough quota",
ErrInternal: "Internal server error",
ErrUnavailableBackend: "Registry service is unavailable",
ErrUnavailableQuota: "Quota service is unavailable",
ErrEndpointAlreadyExists: "Endpoint is already belong to other service",
ErrForbidden: "Forbidden",
ErrUnregistryedEnv: "Env has services",
ErrEnvironmentAlreadyExists: "EnvId already exist",
}

var errManager = errsvc.NewManager()
Expand Down
Loading