MCPcopy
hub / github.com/keploy/keploy / Recover

Function Recover

utils/utils.go:451–465  ·  view source on GitHub ↗

Recover recovers from a panic and logs the stack trace to Sentry. It also stops the global context.

(logger *zap.Logger)

Source from the content-addressed store, hash-verified

449// Recover recovers from a panic and logs the stack trace to Sentry.
450// It also stops the global context.
451func Recover(logger *zap.Logger) {
452 if logger == nil {
453 fmt.Println(Emoji + "Failed to recover from panic. Logger is nil.")
454 return
455 }
456 sentry.Flush(2 * time.Second)
457 if r := recover(); r != nil {
458 HandleRecovery(logger, r, "Recovered from panic")
459 err := Stop(logger, fmt.Sprintf("Recovered from: %s", r))
460 if err != nil {
461 LogError(logger, err, "failed to stop the global context")
462 }
463 sentry.Flush(2 * time.Second)
464 }
465}
466
467// GenerateGithubActions generates a GitHub Actions workflow file for Keploy
468func GenerateGithubActions(logger *zap.Logger, appCmd string) {

Callers 12

startFunction · 0.92
StartMethod · 0.92
RunTestSetMethod · 0.92
RunMethod · 0.92
startNativeAgentMethod · 0.92
StartProxyMethod · 0.92
startMethod · 0.92
StartErrorDrainMethod · 0.92
LoadMethod · 0.92
unLoadMethod · 0.92
LoadMethod · 0.92

Calls 4

HandleRecoveryFunction · 0.85
StopFunction · 0.85
LogErrorFunction · 0.85
FlushMethod · 0.80

Tested by

no test coverage detected