changeset 241:3b688fe04c39

No omitempty if JSON serialising PostgreSQL errors.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 26 Jul 2018 18:08:58 +0200
parents 9012e4045da4
children 24eb518b0394 4ebb791b8278
files controllers/json.go controllers/user.go
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/controllers/json.go	Thu Jul 26 17:56:02 2018 +0200
+++ b/controllers/json.go	Thu Jul 26 18:08:58 2018 +0200
@@ -7,8 +7,9 @@
 	"log"
 	"net/http"
 
+	"github.com/jackc/pgx"
+
 	"gemma.intevation.de/gemma/auth"
-	"github.com/jackc/pgx"
 )
 
 type JSONResult struct {
@@ -54,8 +55,8 @@
 		case pgx.PgError:
 			var res = struct {
 				Result  string `json:"result"`
-				Code    string `json:"code,omitempty"`
-				Message string `json:"message,omitempty"`
+				Code    string `json:"code"`
+				Message string `json:"message"`
 			}{
 				Result:  "failure",
 				Code:    e.Code,
--- a/controllers/user.go	Thu Jul 26 17:56:02 2018 +0200
+++ b/controllers/user.go	Thu Jul 26 18:08:58 2018 +0200
@@ -8,8 +8,9 @@
 	"regexp"
 	"strings"
 
+	"github.com/gorilla/mux"
+
 	"gemma.intevation.de/gemma/auth"
-	"github.com/gorilla/mux"
 )
 
 type (