Revert "Revert "V0.4.0 imporve error response""

This reverts commit 9744f45e86.
This commit is contained in:
yaziming
2019-09-04 20:41:37 +08:00
parent bb4ec17125
commit 6dc687192e
51 changed files with 1373 additions and 416 deletions

View File

@@ -0,0 +1,5 @@
package constants
const (
ContextUser = "currentUser"
)

View File

@@ -0,0 +1,13 @@
package constants
import (
"crawlab/errors"
"net/http"
)
var (
ErrorMongoError = errors.NewSystemOPError(1001, "system error:[mongo]%s", http.StatusInternalServerError)
//users
ErrorUserNotFound = errors.NewBusinessError(10001, "user not found.", http.StatusUnauthorized)
ErrorUsernameOrPasswordInvalid = errors.NewBusinessError(11001, "username or password invalid", http.StatusUnauthorized)
)