diff options
author | Blaster4385 <venkatesh@tablaster.dev> | 2024-06-02 21:36:31 +0530 |
---|---|---|
committer | Blaster4385 <venkatesh@tablaster.dev> | 2024-07-23 01:19:34 +0530 |
commit | f649ea81728ac2ac6feff03ae277652fb0256c8f (patch) | |
tree | 9dd841168b3be2b7762ad199b0675aceb169f192 /server | |
parent | c9e5938dbab49c2735507943de7d6b0b4150978e (diff) |
feat: improve error handling for handleGetFileInfo
Diffstat (limited to 'server')
-rw-r--r-- | server/main.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/main.go b/server/main.go index 53d1c3d..8189750 100644 --- a/server/main.go +++ b/server/main.go @@ -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 { |