rpc/protocol/json/error.go

26 lines
624 B
Go
Raw Normal View History

2017-10-25 14:52:47 +00:00
package json
import (
"errors"
2018-03-20 06:31:54 +00:00
crp "git.loafle.net/commons_go/rpc/protocol"
2017-10-25 14:52:47 +00:00
)
var ErrNullResult = errors.New("result is null")
type Error struct {
// A Number that indicates the error type that occurred.
2018-03-20 06:31:54 +00:00
Code crp.ErrorCode `json:"code"` /* required */
2017-10-25 14:52:47 +00:00
// 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
}