123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package myth
- import (
- "database/sql"
- "errors"
- )
- type Error struct {
- c int
- s string
- }
- func NewError(code int, text string) *Error {
- return &Error{c: code, s: text}
- }
- func (e *Error) Code() int {
- return e.c
- }
- func (e *Error) Error() string {
- return e.s
- }
- func (e *Error) Unwrap() error {
- return errors.New(e.s)
- }
- func (e *Error) Is(err error) bool {
- return errors.Is(errors.New(e.s), err)
- }
- func ErrSQLNoRows(e error) bool {
- return errors.Is(e, sql.ErrNoRows)
- }
|