浏览代码

fix status-code for "locked" swarm and "certificate expired"

These errors were producing the wrong status code,
changing to 503.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 8 年之前
父节点
当前提交
7e44fffe40
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      api/server/httputils/errors.go

+ 2 - 0
api/server/httputils/errors.go

@@ -64,6 +64,8 @@ func GetHTTPErrorStatusCode(err error) int {
 			{"unauthorized", http.StatusUnauthorized},
 			{"unauthorized", http.StatusUnauthorized},
 			{"hasn't been activated", http.StatusForbidden},
 			{"hasn't been activated", http.StatusForbidden},
 			{"this node", http.StatusServiceUnavailable},
 			{"this node", http.StatusServiceUnavailable},
+			{"needs to be unlocked", http.StatusServiceUnavailable},
+			{"certificates have expired", http.StatusServiceUnavailable},
 		} {
 		} {
 			if strings.Contains(errStr, status.keyword) {
 			if strings.Contains(errStr, status.keyword) {
 				statusCode = status.code
 				statusCode = status.code