fix: hide errors from public view, put into logs
This commit is contained in:
parent
c1e8556582
commit
97bbafe827
@ -2,6 +2,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@ -20,7 +21,7 @@ func ListFiles(client valkey.Client) http.HandlerFunc {
|
||||
|
||||
expiresInt, err := client.Do(r.Context(), client.B().Ttl().Key(upload_id).Build()).AsInt64()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
http.Error(w, "not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
expiresIn := time.Second * time.Duration(expiresInt)
|
||||
@ -29,7 +30,8 @@ func ListFiles(client valkey.Client) http.HandlerFunc {
|
||||
files_json, err := client.Do(r.Context(),
|
||||
client.B().Get().Key(upload_id).Build()).ToString()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
log.Printf("upload_id:'%s' err: %s\n", upload_id, err.Error())
|
||||
http.Error(w, "not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
@ -37,7 +39,8 @@ func ListFiles(client valkey.Client) http.HandlerFunc {
|
||||
|
||||
err = json.Unmarshal([]byte(files_json), &fileIds)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
log.Printf("upload_id:'%s' err: %s\n", upload_id, err.Error())
|
||||
http.Error(w, "not found", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user