MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / callCFuncWithErrorGuard

Function callCFuncWithErrorGuard

tsunami/engine/render.go:183–192  ·  view source on GitHub ↗

safely calls the component function with panic recovery

(cfunc any, props map[string]any, componentName string)

Source from the content-addressed store, hash-verified

181
182// safely calls the component function with panic recovery
183func callCFuncWithErrorGuard(cfunc any, props map[string]any, componentName string) (result any) {
184 defer func() {
185 if panicErr := util.PanicHandler(fmt.Sprintf("render component '%s'", componentName), recover()); panicErr != nil {
186 result = renderErrorComponent(componentName, panicErr.Error())
187 }
188 }()
189
190 result = callCFunc(cfunc, props)
191 return result
192}
193
194// uses reflection to call the component function
195func callCFunc(cfunc any, props map[string]any) any {

Callers 1

renderComponentMethod · 0.85

Calls 4

PanicHandlerFunction · 0.92
renderErrorComponentFunction · 0.85
callCFuncFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected