MCPcopy Create free account
hub / github.com/chhoumann/quickadd / withErrorHandling

Function withErrorHandling

src/utils/errorUtils.ts:145–156  ·  view source on GitHub ↗
(
  fn: () => T,
  contextMessage?: string,
  level: ErrorLevel = ErrorLevelEnum.Error
)

Source from the content-addressed store, hash-verified

143 * ```
144 */
145export 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

Callers 1

openUriCallbackMethod · 0.90

Calls 1

reportErrorFunction · 0.85

Tested by

no test coverage detected