mirror of
https://github.com/minio/minio.git
synced 2024-12-27 15:45:55 -05:00
edda244066
Signed-off-by: Harshavardhana <harsha@minio.io>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Copyright 2012 The Gorilla Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Modified to be used with MinIO, uses jsoniter and
|
|
// supports tracing JSON-rpc calls.
|
|
|
|
package json2
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
type ErrorCode int
|
|
|
|
const (
|
|
E_PARSE ErrorCode = -32700
|
|
E_INVALID_REQ ErrorCode = -32600
|
|
E_NO_METHOD ErrorCode = -32601
|
|
E_BAD_PARAMS ErrorCode = -32602
|
|
E_INTERNAL ErrorCode = -32603
|
|
E_SERVER ErrorCode = -32000
|
|
)
|
|
|
|
var ErrNullResult = errors.New("result is null")
|
|
|
|
type Error struct {
|
|
// A Number that indicates the error type that occurred.
|
|
Code ErrorCode `json:"code"` /* required */
|
|
|
|
// A String providing a short description of the error.
|
|
// The message SHOULD be limited to a concise single sentence.
|
|
Message string `json:"message"` /* required */
|
|
|
|
// A Primitive or Structured value that contains additional information about the error.
|
|
Data interface{} `json:"data"` /* optional */
|
|
}
|
|
|
|
func (e *Error) Error() string {
|
|
return e.Message
|
|
}
|