forked from Blaster4385/file-share
feat: improve error handling for handleGetFileInfo
This commit is contained in:
parent
c9e5938dba
commit
f649ea8172
1 changed files with 4 additions and 1 deletions
|
@ -191,7 +191,10 @@ func handleGetFileInfo(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
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 {
|
func storeFileInDB(ctx context.Context, id, fileName string, encryptedData []byte) error {
|
||||||
|
|
Loading…
Reference in a new issue