MCPcopy
hub / github.com/keploy/keploy / HandleRecovery

Function HandleRecovery

utils/utils.go:438–447  ·  view source on GitHub ↗

HandleRecovery handles the common logic for recovering from a panic.

(logger *zap.Logger, r interface{}, errMsg string)

Source from the content-addressed store, hash-verified

436
437// HandleRecovery handles the common logic for recovering from a panic.
438func HandleRecovery(logger *zap.Logger, r interface{}, errMsg string) {
439 err := attachLogFileToSentry(logger, "./keploy-logs.txt")
440 if err != nil {
441 LogError(logger, err, "failed to attach log file to sentry")
442 }
443 sentry.CaptureException(errors.New(fmt.Sprint(r)))
444 // Get the stack trace
445 stackTrace := debug.Stack()
446 LogError(logger, nil, errMsg, zap.String("stack trace", string(stackTrace)))
447}
448
449// Recover recovers from a panic and logs the stack trace to Sentry.
450// It also stops the global context.

Callers 3

RecoverWithoutCloseFunction · 0.92
RecoverFunction · 0.92
RecoverFunction · 0.85

Calls 4

attachLogFileToSentryFunction · 0.85
LogErrorFunction · 0.85
NewMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected