Пример #1
0
package manager

import (
	"errcode"
	"net/http"
)

const errGroup = "account"

var (
	ErrorCodeInvalidAccountId = errcode.Register(errGroup, 20001, errcode.ErrorDescriptor{
		Value:          "INVALIDACCOUNT",
		Message:        "account id  is invalid ",
		Description:    "account is  null",
		HTTPStatusCode: http.StatusBadRequest,
	})
	ErrorCodeIdGetNULL = errcode.Register(errGroup, 20002, errcode.ErrorDescriptor{
		Value:          "NOACCOUNT",
		Message:        "not has account where id is '%s'",
		Description:    "",
		HTTPStatusCode: http.StatusBadRequest,
	})
	ErrorCodeOldPassWdError = errcode.Register(errGroup, 20003, errcode.ErrorDescriptor{
		Value:          "OLDPASSWDERROR",
		Message:        "旧密码错误",
		Description:    "",
		HTTPStatusCode: http.StatusBadRequest,
	})
	ErrorCodeUpdateFAILD = errcode.Register(errGroup, 20004, errcode.ErrorDescriptor{
		Value:          "FAILD",
		Message:        "修改失败",
Пример #2
0
package errors

import (
	"errcode"
	"net/http"
)

var (
	// ErrorCodeUnknown is a generic error that can be used as a last
	// resort if there is no situation-specific error message that can be used
	ErrorCodeMongoError = errcode.Register("mongo", 30201, errcode.ErrorDescriptor{
		Value:          "MongoError",
		Message:        "'%s'",
		Description:    ``,
		HTTPStatusCode: http.StatusBadRequest,
	})

	ErrorCodeOther = errcode.Register("other", 40201, errcode.ErrorDescriptor{
		Value:          "OtherError",
		Message:        "'%s'",
		Description:    ``,
		HTTPStatusCode: http.StatusBadRequest,
	})

//	// ErrorCodeUnsupported is returned when an operation is not supported.
//	ErrorCodeUnsupported = Register("mongo", 2002, ErrorDescriptor{
//		Value:   "UNSUPPORTED",
//		Message: "The operation is unsupported.",
//		Description: `The operation was unsupported due to a missing
//		implementation or invalid set of parameters.`,
//		HTTPStatusCode: http.StatusMethodNotAllowed,