File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -191,8 +191,25 @@ func ParseTimeout(tOut string) *int64 {
191191 return nil
192192}
193193
194+ func GetHTTPStatusFromConfErr (err * configuration.ConfError ) int {
195+ switch err .Code () {
196+ case configuration .ErrObjectDoesNotExist :
197+ return http .StatusNotFound
198+ case configuration .ErrObjectAlreadyExists :
199+ return http .StatusConflict
200+ case configuration .ErrNoParentSpecified :
201+ return http .StatusBadRequest
202+ default :
203+ return http .StatusInternalServerError
204+ }
205+ }
206+
194207func GetHTTPStatusFromErr (err error ) int {
208+ confError := & configuration.ConfError {}
209+
195210 switch {
211+ case errors .As (err , & confError ):
212+ return GetHTTPStatusFromConfErr (confError )
196213 case errors .Is (err , client_errors .ErrAlreadyExists ):
197214 return http .StatusConflict
198215 case errors .Is (err , client_errors .ErrNotFound ):
You can’t perform that action at this time.
0 commit comments