// errPanic panics
548988
func errPanic(err error, line int) {
	panic(fmt.Errorf("Parse error on line %d:\n%s", line, err))
}
734824
func (l *Logger) Panicf(format string, args ...interface{}) {
	l.logger().Panicf(format, args...)
}
897080
func (vtg *VTGate) HandlePanic(err *error) {
	if x := recover(); x != nil {
		log.Errorf("Uncaught panic:\n%v\n%s", x, tb.Stack(4))
		*err = fmt.Errorf("uncaught panic: %v, vtgate: %v", x, servenv.ListeningURL.String())
		errorCounts.Add([]string{"Panic", "Unknown", "Unknown", vtrpcpb.Code_INTERNAL.String()}, 1)
	}
}
308921
func (entry *Entry) Panicln(args ...interface{}) {
	if entry.lgEntry.Logger.Level >= lg.PanicLevel {
		entry.lgEntry.WithFields(entry.fields).Panicln(entry.sprintlnn(args...))
	}
}
601012
func (as *Assertion) ToPanic() {
	var panicObj interface{}
	func() {
		defer func() {
			if r := recover(); r != nil {
				panicObj = r
			}
		}()
		as.Value.(func())()
	}()

	if panicObj == nil {
		as.Test.PrintError("Expected panic")
	}
}
540748
func panicRecover(f func(w dns.ResponseWriter, r *dns.Msg)) func(w dns.ResponseWriter, r *dns.Msg) {
	return func(w dns.ResponseWriter, r *dns.Msg) {
		defer func() {
			if rec := recover(); rec != nil {
				m := new(dns.Msg)
				m.SetRcode(r, 2)
				if err := w.WriteMsg(m); err != nil {
					logging.Error.Println(err)
				}
				logging.Error.Println(rec)
			}
		}()
		f(w, r)
	}
}
647428
func panicRecover(input *models.RunningInput) {
	if err := recover(); err != nil {
		trace := make([]byte, 2048)
		runtime.Stack(trace, true)
		log.Printf("E! FATAL: Input [%s] panicked: %s, Stack:\n%s\n",
			input.Name(), err, trace)
		log.Println("E! PLEASE REPORT THIS PANIC ON GITHUB with " +
			"stack trace, configuration, and OS information: " +
			"https://github.com/influxdata/telegraf/issues/new/choose")
	}
}
223484
func (l *StubLogger) Panicf(format string, args ...interface{}) {
	panic(fmt.Sprintf(format, args...))
}
462316
func (logger *Logger) Panicln(args ...interface{}) {
	if logger.std.Level >= lg.PanicLevel {
		logger.header(1).Panicln(args...)
	}
}
559513
func (l *Logger) Panic(msg interface{}, data ...interface{}) {
	if l.shouldAppend(PANIC) {
		l.makeLog(msg, PANIC, data)
		panic(msg)
	}
}
377508
func (l logger) Panicf(format string, args ...interface{}) {
	l.sourced().Panicf(format, args...)
}
397767
func PanicHandler(h http.Handler, errH http.Handler) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		defer func() {
			if err := recover(); err != nil {
				if errH != nil {
					ew := &errResponseWriter{w, err}
					errH.ServeHTTP(ew, r)
				} else {
					http.Error(w, fmt.Sprintf("%s", err), http.StatusInternalServerError)
				}
			}
		}()

		// Call the protected handler
		h.ServeHTTP(w, r)
	}
}
726710
func logPanic(r interface{}) {
	// Same as stdlib http server code. Manually allocate stack trace buffer size
	// to prevent excessively large logs
	const size = 64 << 10
	stacktrace := make([]byte, size)
	stacktrace = stacktrace[:runtime.Stack(stacktrace, false)]
	if _, ok := r.(string); ok {
		klog.Errorf("Observed a panic: %s\n%s", r, stacktrace)
	} else {
		klog.Errorf("Observed a panic: %#v (%v)\n%s", r, r, stacktrace)
	}
}
1332846
func IsRPCError(err error) bool {
	_, ok := err.(client.RPCError)
	return ok
}
1285242
func (log *impl) AuditPanic() {
	if err := recover(); err != nil {
		buf := make([]byte, 8192)
		log.AuditErrf("Panic caused by err: %s", err)

		runtime.Stack(buf, false)
		log.AuditErrf("Stack Trace (Current frame) %s", buf)

		runtime.Stack(buf, true)
		log.Warningf("Stack Trace (All frames): %s", buf)
	}
}
1169788
func PanicLoggerUnaryServerInterceptor(log *logrus.Entry) grpc.UnaryServerInterceptor {
	return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (_ interface{}, err error) {
		defer func() {
			if r := recover(); r != nil {
				log.Errorf("Recovered from panic: %+v\n%s", r, debug.Stack())
				err = status.Errorf(codes.Internal, "%s", r)
			}
		}()
		return handler(ctx, req)
	}
}
87016
func (s *state) errRecover(errp *error) {
	if e := recover(); e != nil {
		switch e := e.(type) {
		case runtime.Error:
			*errp = s.errFromNode("%s: %v\n%v", s.callAnnotation(), e, string(debug.Stack()))
		default:
			*errp = s.errFromNode("%s: %v", s.callAnnotation(), e)
		}
	}
}