Files
schedule_converter/pkg/errors/errors.go

34 lines
496 B
Go
Raw Normal View History

package errors
import (
"errors"
"fmt"
)
var ErrLoginFailed = errors.New("login failed")
type ScheduleError struct {
Op string
Err error
Msg string
}
func (e *ScheduleError) Error() string {
if e.Msg != "" {
return fmt.Sprintf("%s: %s: %v", e.Op, e.Msg, e.Err)
}
return fmt.Sprintf("%s: %v", e.Op, e.Err)
}
func (e *ScheduleError) Unwrap() error {
return e.Err
}
func New(op string, err error, msg string) error {
return &ScheduleError{
Op: op,
Err: err,
Msg: msg,
}
}