feat: improve error handling for handleGetFileInfo

This commit is contained in:
Blaster4385 2024-06-02 21:36:31 +05:30
parent c9e5938dba
commit f649ea8172

View file

@ -191,7 +191,10 @@ func handleGetFileInfo(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(fileInfo)
if err := json.NewEncoder(w).Encode(fileInfo); err != nil {
handleError(w, fmt.Errorf("error encoding response: %v", err), http.StatusInternalServerError)
return
}
}
func storeFileInDB(ctx context.Context, id, fileName string, encryptedData []byte) error {