2023-06-15 21:22:51 +08:00
|
|
|
//
|
|
|
|
// error_helper.go
|
|
|
|
// Copyright (C) 2022 tiglog <me@tiglog.com>
|
|
|
|
//
|
|
|
|
// Distributed under terms of the MIT license.
|
|
|
|
//
|
|
|
|
|
|
|
|
package helper
|
|
|
|
|
2023-07-15 16:36:20 +08:00
|
|
|
import "github.com/pkg/errors"
|
|
|
|
|
2023-06-15 21:22:51 +08:00
|
|
|
func CheckErr(err error) {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
2023-07-15 16:36:20 +08:00
|
|
|
|
|
|
|
func Error(msg string) error {
|
|
|
|
return errors.New(msg)
|
|
|
|
}
|
|
|
|
|
|
|
|
func WrapErr(err error, msg string) error {
|
|
|
|
return errors.Wrap(err, msg)
|
|
|
|
}
|