fix: make user signup work for the minimum

A lot of work is still to be done ...
This commit is contained in:
Muyao CHEN
2024-10-06 18:26:57 +02:00
parent 7b8abf8e5c
commit 344485d082
13 changed files with 103 additions and 24 deletions

View File

@ -24,18 +24,28 @@ package errno
import "net/http"
type PlatformLevelErrCode string
const (
InternalErrorCode = "InternalError"
InvalidParameterCode = "InvalidParameter"
AuthFailureCode = "AuthFailure"
ResourceNotFoundCode = "ResourceNotFound"
FailedOperationCode = "FailedOperation"
)
var (
OK = &Errno{HTTP: http.StatusOK, Code: "", Message: ""}
InternalServerErr = &Errno{
HTTP: http.StatusInternalServerError,
Code: "InternalError",
Code: InternalErrorCode,
Message: "Internal server error",
}
PageNotFoundErr = &Errno{
HTTP: http.StatusNotFound,
Code: "ResourceNotFound.PageNotFound",
Code: ErrorCode(ResourceNotFoundCode, "PageNotFound"),
Message: "Page not found",
}
)

View File

@ -28,6 +28,10 @@ type Errno struct {
Message string
}
func ErrorCode(platformErrCode string, resourceErrCode string) string {
return platformErrCode + "." + resourceErrCode
}
// Error implements Error() method in error interface
func (err *Errno) Error() string {
return err.Message