mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-04 01:39:16 -05:00
feat: add new error code type
This commit is contained in:
committed by
Florian Schade
parent
fdb3572cc0
commit
2668ca664a
@@ -59,6 +59,8 @@ const (
|
||||
Unauthenticated
|
||||
// PreconditionFailed the request cannot be made and this error response is sent back
|
||||
PreconditionFailed
|
||||
// ItemIsLocked The item is locked by another process. Try again later.
|
||||
ItemIsLocked
|
||||
)
|
||||
|
||||
var errorCodes = [...]string{
|
||||
@@ -80,6 +82,7 @@ var errorCodes = [...]string{
|
||||
"quotaLimitReached",
|
||||
"unauthenticated",
|
||||
"preconditionFailed",
|
||||
"itemIsLocked",
|
||||
}
|
||||
|
||||
// New constructs a new errorcode.Error
|
||||
@@ -129,6 +132,8 @@ func (e Error) Render(w http.ResponseWriter, r *http.Request) {
|
||||
status = http.StatusConflict
|
||||
case NotAllowed:
|
||||
status = http.StatusMethodNotAllowed
|
||||
case ItemIsLocked:
|
||||
status = http.StatusLocked
|
||||
default:
|
||||
status = http.StatusInternalServerError
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user