summaryrefslogtreecommitdiffstats
path: root/client/go/vespa/document.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/go/vespa/document.go')
-rw-r--r--client/go/vespa/document.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/client/go/vespa/document.go b/client/go/vespa/document.go
index e08208eba6d..e8620c59033 100644
--- a/client/go/vespa/document.go
+++ b/client/go/vespa/document.go
@@ -7,6 +7,7 @@ package vespa
import (
"bytes"
"encoding/json"
+ "fmt"
"io"
"net/http"
"net/url"
@@ -70,7 +71,9 @@ func sendOperation(documentId string, jsonFile string, service *Service, operati
}
var doc map[string]interface{}
- json.Unmarshal(documentData, &doc)
+ if err := json.Unmarshal(documentData, &doc); err != nil {
+ return util.Failure(fmt.Sprintf("Document is not valid JSON: %s", err))
+ }
operationInFile := operationIn(doc)
if operation == anyOperation { // Operation is decided by file content