update error message
This commit is contained in:
1 parent
1665cc78cf
commit
7acc4ebbd6
3 files changed
+20
-13
No files matched your search
@@ -5,11 +5,12 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
)
|
||||
|
||||
func createError(status codes.Code, details ...interface{}) error {
|
||||
return ErrorDescription{grpcStatus: status, details: details}
|
||||
func createError(msg string, status codes.Code, details ...interface{}) error {
|
||||
return ErrorDescription{message: msg, grpcStatus: status, details: details}
|
||||
}
|
||||
|
||||
type ErrorDescription struct {
|
||||
message string
|
||||
grpcStatus codes.Code
|
||||
details []interface{}
|
||||
}
|
||||
@@ -18,6 +19,10 @@ func (e ErrorDescription) Error() string {
|
||||
return fmt.Sprintf("%v", e)
|
||||
}
|
||||
|
||||
func (e ErrorDescription) Message() string {
|
||||
return e.message
|
||||
}
|
||||
|
||||
func (e ErrorDescription) ConvertToGrpcStatus() codes.Code {
|
||||
return e.grpcStatus
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user