mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
Iodine now serializes error type as string
This commit is contained in:
parent
9883af2337
commit
17d432e7f1
2
Godeps/Godeps.json
generated
2
Godeps/Godeps.json
generated
@ -20,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/minio-io/iodine",
|
"ImportPath": "github.com/minio-io/iodine",
|
||||||
"Rev": "b44f7faaff4e722dcdb60b9788d33850606dc07b"
|
"Rev": "55cc4d4256c68fbd6f0775f1a25e37e6a2f6457e"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "gopkg.in/check.v1",
|
"ImportPath": "gopkg.in/check.v1",
|
||||||
|
3
Godeps/_workspace/src/github.com/minio-io/iodine/iodine.go
generated
vendored
3
Godeps/_workspace/src/github.com/minio-io/iodine/iodine.go
generated
vendored
@ -22,6 +22,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -33,6 +34,7 @@ import (
|
|||||||
type Error struct {
|
type Error struct {
|
||||||
EmbeddedError error `json:"-"`
|
EmbeddedError error `json:"-"`
|
||||||
ErrorMessage string
|
ErrorMessage string
|
||||||
|
ErrorType string
|
||||||
|
|
||||||
Stack []StackEntry
|
Stack []StackEntry
|
||||||
}
|
}
|
||||||
@ -106,6 +108,7 @@ func New(err error, data map[string]string) error {
|
|||||||
newErr = Error{
|
newErr = Error{
|
||||||
EmbeddedError: err,
|
EmbeddedError: err,
|
||||||
ErrorMessage: err.Error(),
|
ErrorMessage: err.Error(),
|
||||||
|
ErrorType: reflect.TypeOf(err).String(),
|
||||||
Stack: []StackEntry{},
|
Stack: []StackEntry{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
Godeps/_workspace/src/github.com/minio-io/iodine/iodine_test.go
generated
vendored
8
Godeps/_workspace/src/github.com/minio-io/iodine/iodine_test.go
generated
vendored
@ -17,7 +17,6 @@
|
|||||||
package iodine
|
package iodine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
@ -34,15 +33,10 @@ func TestIodine(t *testing.T) {
|
|||||||
if len(typedError.Stack) != 4 {
|
if len(typedError.Stack) != 4 {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
jsonResult, err := typedError.EmitJSON()
|
_, err := json.MarshalIndent(typedError, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
var prettyBuffer bytes.Buffer
|
|
||||||
json.Indent(&prettyBuffer, jsonResult, "", " ")
|
|
||||||
if prettyBuffer.String() == "" {
|
|
||||||
t.Fail()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user