safely calls the component function with panic recovery
(cfunc any, props map[string]any, componentName string)
| 181 | |
| 182 | // safely calls the component function with panic recovery |
| 183 | func 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 |
| 195 | func callCFunc(cfunc any, props map[string]any) any { |
no test coverage detected