File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ func NewNotFound(format string, a ...interface{}) APIException {
6363 return newException (usedNamespace , NotFound , format , a ... )
6464}
6565
66+ // NewConflict todo
67+ func NewConflict (format string , a ... interface {}) APIException {
68+ return newException (usedNamespace , Conflict , format , a ... )
69+ }
70+
6671// NewInternalServerError 500
6772func NewInternalServerError (format string , a ... interface {}) APIException {
6873 return newException (usedNamespace , InternalServerError , format , a ... )
@@ -81,3 +86,17 @@ func IsNotFoundError(err error) bool {
8186
8287 return e .ErrorCode () == NotFound && e .Namespace () == GlobalNamespace .String ()
8388}
89+
90+ // IsConflictError 判断是否是Conflict
91+ func IsConflictError (err error ) bool {
92+ if err == nil {
93+ return false
94+ }
95+
96+ e , ok := err .(APIException )
97+ if ! ok {
98+ return false
99+ }
100+
101+ return e .ErrorCode () == Conflict && e .Namespace () == GlobalNamespace .String ()
102+ }
You can’t perform that action at this time.
0 commit comments