File tree 1 file changed +17
-0
lines changed
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 {
191
191
return nil
192
192
}
193
193
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
+
194
207
func GetHTTPStatusFromErr (err error ) int {
208
+ confError := & configuration.ConfError {}
209
+
195
210
switch {
211
+ case errors .As (err , & confError ):
212
+ return GetHTTPStatusFromConfErr (confError )
196
213
case errors .Is (err , client_errors .ErrAlreadyExists ):
197
214
return http .StatusConflict
198
215
case errors .Is (err , client_errors .ErrNotFound ):
You can’t perform that action at this time.
0 commit comments