MCPcopy
hub / github.com/wavetermdev/waveterm / PanicHandler

Function PanicHandler

tsunami/util/util.go:25–35  ·  view source on GitHub ↗

PanicHandler handles panic recovery and logging. It can be called directly with recover() without checking for nil first. Example usage: defer func() { util.PanicHandler("operation name", recover()) }()

(debugStr string, recoverVal any)

Source from the content-addressed store, hash-verified

23// util.PanicHandler("operation name", recover())
24// }()
25func PanicHandler(debugStr string, recoverVal any) error {
26 if recoverVal == nil {
27 return nil
28 }
29 log.Printf("[panic] in %s: %v\n", debugStr, recoverVal)
30 debug.PrintStack()
31 if err, ok := recoverVal.(error); ok {
32 return fmt.Errorf("panic in %s: %w", debugStr, err)
33 }
34 return fmt.Errorf("panic in %s: %v", debugStr, recoverVal)
35}
36
37func GetHomeDir() string {
38 homeVar, err := os.UserHomeDir()

Callers 15

EventMethod · 0.92
runEffectUnmountMethod · 0.92
runEffectMethod · 0.92
callCFuncWithErrorGuardFunction · 0.92
handleRenderMethod · 0.92
handleDataMethod · 0.92
handleConfigMethod · 0.92
handleSchemasMethod · 0.92
handleModalResultMethod · 0.92
handleTermInputMethod · 0.92
handleDynContentMethod · 0.92
handleSSEMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected