1
0
Fork 0
telegram/errors.go
2020-01-09 20:50:28 +05:00

29 lines
553 B
Go

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)
}