mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-10-13 11:39:13 +00:00

Some checks are pending
Release 3X-UI / build (386) (push) Waiting to run
Release 3X-UI / build (amd64) (push) Waiting to run
Release 3X-UI / build (arm64) (push) Waiting to run
Release 3X-UI / build (armv5) (push) Waiting to run
Release 3X-UI / build (armv6) (push) Waiting to run
Release 3X-UI / build (armv7) (push) Waiting to run
Release 3X-UI / build (s390x) (push) Waiting to run
Release 3X-UI / Build for Windows (push) Waiting to run
28 lines
440 B
Go
28 lines
440 B
Go
package common
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
|
)
|
|
|
|
func NewErrorf(format string, a ...any) error {
|
|
msg := fmt.Sprintf(format, a...)
|
|
return errors.New(msg)
|
|
}
|
|
|
|
func NewError(a ...any) error {
|
|
msg := fmt.Sprintln(a...)
|
|
return errors.New(msg)
|
|
}
|
|
|
|
func Recover(msg string) any {
|
|
panicErr := recover()
|
|
if panicErr != nil {
|
|
if msg != "" {
|
|
logger.Error(msg, "panic:", panicErr)
|
|
}
|
|
}
|
|
return panicErr
|
|
}
|