Documentation ¶
Overview ¶
Package ecode is the package that unifies the definition of http error codes or grpc error codes here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Success = errcode.Success InvalidParams = errcode.InvalidParams InternalServerError = errcode.InternalServerError NotFound = errcode.NotFound Timeout = errcode.Timeout TooManyRequests = errcode.TooManyRequests Forbidden = errcode.Forbidden LimitExceed = errcode.LimitExceed Conflict = errcode.Conflict TooEarly = errcode.TooEarly DeadlineExceeded = errcode.DeadlineExceeded AccessDenied = errcode.AccessDenied MethodNotAllowed = errcode.MethodNotAllowed Canceled = errcode.Canceled Unknown = errcode.Unknown PermissionDenied = errcode.PermissionDenied ResourceExhausted = errcode.ResourceExhausted FailedPrecondition = errcode.FailedPrecondition Aborted = errcode.Aborted OutOfRange = errcode.OutOfRange Unimplemented = errcode.Unimplemented DataLoss = errcode.DataLoss )
http system level error code, error code range 10000~20000
var ( StatusSuccess = errcode.StatusSuccess StatusCanceled = errcode.StatusCanceled StatusUnknown = errcode.StatusUnknown StatusInvalidParams = errcode.StatusInvalidParams StatusDeadlineExceeded = errcode.StatusDeadlineExceeded StatusNotFound = errcode.StatusNotFound StatusAlreadyExists = errcode.StatusAlreadyExists StatusPermissionDenied = errcode.StatusPermissionDenied StatusResourceExhausted = errcode.StatusResourceExhausted StatusFailedPrecondition = errcode.StatusFailedPrecondition StatusAborted = errcode.StatusAborted StatusOutOfRange = errcode.StatusOutOfRange StatusUnimplemented = errcode.StatusUnimplemented StatusInternalServerError = errcode.StatusInternalServerError StatusDataLoss = errcode.StatusDataLoss StatusTimeout = errcode.StatusTimeout StatusTooManyRequests = errcode.StatusTooManyRequests StatusForbidden = errcode.StatusForbidden StatusLimitExceed = errcode.StatusLimitExceed StatusMethodNotAllowed = errcode.StatusMethodNotAllowed StatusAccessDenied = errcode.StatusAccessDenied StatusConflict = errcode.StatusConflict )
rpc system level error code, with status prefix, error code range 30000~40000
var ( ErrCreateUserExample = errcode.NewError(userExampleBaseCode+1, "failed to create "+userExampleName) ErrDeleteByIDUserExample = errcode.NewError(userExampleBaseCode+2, "failed to delete "+userExampleName) ErrUpdateByIDUserExample = errcode.NewError(userExampleBaseCode+3, "failed to update "+userExampleName) ErrGetByIDUserExample = errcode.NewError(userExampleBaseCode+4, "failed to get "+userExampleName+" details") ErrListUserExample = errcode.NewError(userExampleBaseCode+5, "failed to list of "+userExampleName) )
userExample business-level http error codes. the userExampleNO value range is 1~100, if the same error code is used, it will cause panic.
var ( StatusCreateUserExample = errcode.NewRPCStatus(_userExampleBaseCode+1, "failed to create "+_userExampleName) StatusDeleteByIDUserExample = errcode.NewRPCStatus(_userExampleBaseCode+2, "failed to delete "+_userExampleName) StatusUpdateByIDUserExample = errcode.NewRPCStatus(_userExampleBaseCode+3, "failed to update "+_userExampleName) StatusGetByIDUserExample = errcode.NewRPCStatus(_userExampleBaseCode+4, "failed to get "+_userExampleName+" details") StatusListUserExample = errcode.NewRPCStatus(_userExampleBaseCode+5, "failed to list of "+_userExampleName) )
userExample business-level rpc error codes. the _userExampleNO value range is 1~100, if the same error code is used, it will cause panic.
var GetErrorCode = errcode.GetErrorCode
GetErrorCode get error code from error
var GetStatusCode = errcode.GetStatusCode
GetStatusCode get status code from error returned by RPC invoke
var SkipResponse = errcode.SkipResponse
var StatusSkipResponse = errcode.SkipResponse
StatusSkipResponse is only use for grpc-gateway
Functions ¶
Types ¶
This section is empty.