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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"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()
|
expiresInt, err := client.Do(r.Context(), client.B().Ttl().Key(upload_id).Build()).AsInt64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, "not found", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
expiresIn := time.Second * time.Duration(expiresInt)
|
expiresIn := time.Second * time.Duration(expiresInt)
|
||||||
@ -29,7 +30,8 @@ func ListFiles(client valkey.Client) http.HandlerFunc {
|
|||||||
files_json, err := client.Do(r.Context(),
|
files_json, err := client.Do(r.Context(),
|
||||||
client.B().Get().Key(upload_id).Build()).ToString()
|
client.B().Get().Key(upload_id).Build()).ToString()
|
||||||
if err != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +39,8 @@ func ListFiles(client valkey.Client) http.HandlerFunc {
|
|||||||
|
|
||||||
err = json.Unmarshal([]byte(files_json), &fileIds)
|
err = json.Unmarshal([]byte(files_json), &fileIds)
|
||||||
if err != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user