Handling unhandled errors in the InfoCannedPolicy method. (#10575)

This commit is contained in:
飞雪无情
2020-09-28 01:24:04 +08:00
committed by GitHub
parent 511424a287
commit 27d9bd04e5

View File

@@ -722,7 +722,10 @@ func (a adminAPIHandlers) InfoCannedPolicy(w http.ResponseWriter, r *http.Reques
return
}
json.NewEncoder(w).Encode(policy)
if err = json.NewEncoder(w).Encode(policy); err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}
w.(http.Flusher).Flush()
}