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) } }