You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
480 B
Go

package wire
import (
"encoding/json"
"fmt"
)
type Error struct {
val error
}
4 years ago
func (e Error) Error() string { return e.val.Error() }
func (e Error) NetTag() string { return "error" }
func (e Error) Unwrap() error { return e.val }
func (e Error) MarshalJSON() ([]byte, error) {
return json.Marshal(e.Error())
}
func Errorf(t string, args ...interface{}) Error {
return Error{val: fmt.Errorf(t, args...)}
}
4 years ago
func init() {
Register(func() Value { return new(Error) })
}