Error handling for the /rest/uploads endpoint
This commit is contained in:
parent
2c4c9fdde6
commit
f180900d79
@ -152,7 +152,13 @@ func (ws *WebService) handleConfig(w http.ResponseWriter, r *http.Request) {
|
|||||||
func (ws *WebService) getUploads(w http.ResponseWriter, r *http.Request) {
|
func (ws *WebService) getUploads(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
ups := ws.Uploader.Uploads
|
ups := ws.Uploader.Uploads
|
||||||
text, _ := json.Marshal(ups)
|
|
||||||
|
text, err := json.Marshal(ups)
|
||||||
|
if err != nil {
|
||||||
|
daulog.SendLog(fmt.Sprintf("err: %v", err), daulog.LogTypeError)
|
||||||
|
w.Write([]byte("could not marshall uploads?"))
|
||||||
|
return
|
||||||
|
}
|
||||||
w.Write([]byte(text))
|
w.Write([]byte(text))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user