From c81658b4dd96098b6c55629816ec9d6a4b606332 Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Wed, 27 Nov 2024 00:16:25 +0100 Subject: [PATCH] check all errors --- pkg/lmd/response.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/lmd/response.go b/pkg/lmd/response.go index 806c8c5..276cedc 100644 --- a/pkg/lmd/response.go +++ b/pkg/lmd/response.go @@ -503,7 +503,9 @@ func (res *Response) JSON(buf io.Writer) error { } } - res.WriteDataResponse(json) + if err := res.WriteDataResponse(json); err != nil { + return err + } json.WriteRaw("]") err := json.Flush() @@ -521,7 +523,9 @@ func (res *Response) WrappedJSON(buf io.Writer) error { defer jsoniter.ConfigCompatibleWithStandardLibrary.ReturnStream(json) json.WriteRaw("{\"data\":\n[") - res.WriteDataResponse(json) + if err := res.WriteDataResponse(json); err != nil { + return err + } json.WriteRaw("]\n,\"failed\": {") num := 0 for k, v := range res.Failed {