Files
wfc-server/common/errors.go
2026-12-02 16:51:23 -05:00

28 lines
521 B
Go

package common
import "errors"
var (
ErrFrontendBadIndex = errors.New("incorrect connection index")
ErrBackendBusy = errors.New("backend is busy")
)
// ShouldNotError panics if the error is not nil.
func ShouldNotError(err error) {
if err != nil {
panic(err)
}
}
// ShouldNotErrorUnless panics if the error is not nil and not in the allowed list.
func ShouldNotErrorUnless(err error, allowed ...error) {
if err != nil {
for _, a := range allowed {
if err == a {
return
}
}
panic(err)
}
}