Improve jsonrpc error string formatting
package jsonrpc
import (
+ "encoding/json"
"fmt"
"net/http"
@@ -112,7 +113,8 @@ type Error struct {
}
func (e *Error) Error() string {
- return fmt.Sprintf("jsonrpc: code: %d, message: %s, data: %+v", e.Code, e.Message, e.Data)
+ bs, _ := json.Marshal(e.Data)
+ return fmt.Sprintf("JSONRPCError(code=%d, message=%q, data=%s)", e.Code, e.Message, bs)
}
func firstOf(message ...interface{}) interface{} {
