panicrecovery

package
v4.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package panicrecovery converts panics on kernel request paths into ordinary errors so one faulty handler cannot terminate the kernel process.

Index

Constants

View Source
const MaxStackBytes = 16 << 10

MaxStackBytes bounds the stack trace written for one recovered panic.

Variables

This section is empty.

Functions

func InternalError

func InternalError() error

InternalError is the status returned to a gRPC caller after a recovered panic. It deliberately carries no panic value or stack.

func ServerOptions

func ServerOptions() []grpc.ServerOption

ServerOptions installs only the recovery interceptors. Servers that chain other interceptors should place UnaryServerInterceptor and StreamServerInterceptor first in their chains instead.

func Stack

func Stack() string

Stack returns the calling goroutine's stack trace, truncated to MaxStackBytes.

func StreamServerInterceptor

func StreamServerInterceptor() grpc.StreamServerInterceptor

StreamServerInterceptor is the streaming counterpart of UnaryServerInterceptor.

func UnaryServerInterceptor

func UnaryServerInterceptor() grpc.UnaryServerInterceptor

UnaryServerInterceptor recovers a panic raised by the unary handler or by any interceptor chained after it, logs it with a bounded stack trace, and returns codes.Internal.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL