From 4bef24be00400c098a084769a4babcd2d9ed8799 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 6 Jun 2011 09:07:07 -0700 Subject: [PATCH] UI: log download helper errors --- server/go/camlistored/ui.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/go/camlistored/ui.go b/server/go/camlistored/ui.go index 17ddfd138..c6d62a3bd 100644 --- a/server/go/camlistored/ui.go +++ b/server/go/camlistored/ui.go @@ -297,6 +297,14 @@ func (ui *UIHandler) serveDownload(rw http.ResponseWriter, req *http.Request) { schema := fr.FileSchema() rw.Header().Set("Content-Type", "application/octet-stream") rw.Header().Set("Content-Length", fmt.Sprintf("%d", schema.Size)) - io.Copy(rw, fr) - + n, err := io.Copy(rw, fr) + if err != nil { + log.Printf("error serving download of file schema %s: %v", blobref, err) + return + } + if n != int64(schema.Size) { + log.Printf("error serving download of file schema %s: sent %d, expected size of %d", + blobref, n, schema.Size) + return + } }