From 17d432e7f122765057d7b2f936aef4f031c9267c Mon Sep 17 00:00:00 2001 From: "Frederick F. Kautz IV" Date: Thu, 26 Mar 2015 22:48:09 -0700 Subject: [PATCH] Iodine now serializes error type as string --- Godeps/Godeps.json | 2 +- .../_workspace/src/github.com/minio-io/iodine/iodine.go | 3 +++ .../src/github.com/minio-io/iodine/iodine_test.go | 8 +------- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 82325aa0a..ed21743e3 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -20,7 +20,7 @@ }, { "ImportPath": "github.com/minio-io/iodine", - "Rev": "b44f7faaff4e722dcdb60b9788d33850606dc07b" + "Rev": "55cc4d4256c68fbd6f0775f1a25e37e6a2f6457e" }, { "ImportPath": "gopkg.in/check.v1", diff --git a/Godeps/_workspace/src/github.com/minio-io/iodine/iodine.go b/Godeps/_workspace/src/github.com/minio-io/iodine/iodine.go index 093fa5f1b..f1eead9f6 100644 --- a/Godeps/_workspace/src/github.com/minio-io/iodine/iodine.go +++ b/Godeps/_workspace/src/github.com/minio-io/iodine/iodine.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "path" + "reflect" "runtime" "strconv" "strings" @@ -33,6 +34,7 @@ import ( type Error struct { EmbeddedError error `json:"-"` ErrorMessage string + ErrorType string Stack []StackEntry } @@ -106,6 +108,7 @@ func New(err error, data map[string]string) error { newErr = Error{ EmbeddedError: err, ErrorMessage: err.Error(), + ErrorType: reflect.TypeOf(err).String(), Stack: []StackEntry{}, } } diff --git a/Godeps/_workspace/src/github.com/minio-io/iodine/iodine_test.go b/Godeps/_workspace/src/github.com/minio-io/iodine/iodine_test.go index 5f52b9598..9b8ddc0c5 100644 --- a/Godeps/_workspace/src/github.com/minio-io/iodine/iodine_test.go +++ b/Godeps/_workspace/src/github.com/minio-io/iodine/iodine_test.go @@ -17,7 +17,6 @@ package iodine import ( - "bytes" "encoding/json" "errors" "testing" @@ -34,15 +33,10 @@ func TestIodine(t *testing.T) { if len(typedError.Stack) != 4 { t.Fail() } - jsonResult, err := typedError.EmitJSON() + _, err := json.MarshalIndent(typedError, "", " ") if err != nil { t.Fail() } - var prettyBuffer bytes.Buffer - json.Indent(&prettyBuffer, jsonResult, "", " ") - if prettyBuffer.String() == "" { - t.Fail() - } } default: {