1
0
Fork 0
telegram/errors.go

30 lines
553 B
Go
Raw Normal View History

2020-01-09 15:27:00 +00:00
package telegram
import (
"fmt"
"golang.org/x/xerrors"
)
type Error struct {
Code int `json:"error_code"`
Description string `json:"description"`
Parameters []*ResponseParameters `json:"parameters,omitempty"`
frame xerrors.Frame
}
func (e Error) FormatError(p xerrors.Printer) error {
p.Printf("%d %s", e.Code, e.Description)
e.frame.Format(p)
return nil
}
func (e Error) Format(s fmt.State, r rune) {
xerrors.FormatError(e, s, r)
}
func (e Error) Error() string {
return fmt.Sprint(e)
}