mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
add email verification
This commit is contained in:
@@ -38,6 +38,7 @@ type Error struct {
|
||||
HttpStatusCode int
|
||||
Message string
|
||||
BaseError []error
|
||||
Context interface{}
|
||||
}
|
||||
|
||||
// Error returns the error message
|
||||
@@ -81,6 +82,19 @@ func NewIncompleteOrIncorrectSubmissionError(err error) *Error {
|
||||
ErrIncompleteOrIncorrectSubmission.Message, err)
|
||||
}
|
||||
|
||||
// NewErrorWithContext returns a new error instance with specified context
|
||||
func NewErrorWithContext(baseError *Error, context interface{}) *Error {
|
||||
return &Error{
|
||||
Category: baseError.Category,
|
||||
SubCategory: baseError.SubCategory,
|
||||
Index: baseError.Index,
|
||||
HttpStatusCode: baseError.HttpStatusCode,
|
||||
Message: baseError.Message,
|
||||
BaseError: baseError.BaseError,
|
||||
Context: context,
|
||||
}
|
||||
}
|
||||
|
||||
// Or would return the error from err parameter if the this error is defined in this project,
|
||||
// or return the default error
|
||||
func Or(err error, defaultErr *Error) *Error {
|
||||
|
||||
Reference in New Issue
Block a user