( fn: () => T, contextMessage?: string, level: ErrorLevel = ErrorLevelEnum.Error )
| 143 | * ``` |
| 144 | */ |
| 145 | export function withErrorHandling<T>( |
| 146 | fn: () => T, |
| 147 | contextMessage?: string, |
| 148 | level: ErrorLevel = ErrorLevelEnum.Error |
| 149 | ): T | undefined { |
| 150 | try { |
| 151 | return fn(); |
| 152 | } catch (err) { |
| 153 | reportError(err, contextMessage, level); |
| 154 | return undefined; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Async error boundary - wraps an async function and reports any errors it throws |
no test coverage detected