Function: withUtilityErrorHandling()
withUtilityErrorHandling<
T>(operation: () =>Promise<T>,operationName:string,fallbackValue?:T,shouldThrow?:boolean):Promise<T>
Defined in: shared/utils/errorHandling.ts:482
Simple error handling wrapper for utility functions. Provides consistent error logging and error response formatting.
Type Parametersโ
Tโ
T
Parametersโ
operationโ
() => Promise<T>
The async operation to execute
operationNameโ
string
Name of the operation for logging
fallbackValue?โ
T
Value to return if operation fails when shouldThrow is false
shouldThrow?โ
boolean = false
Whether to throw on error or return fallback value
Returnsโ
Promise<T>
Promise resolving to operation result or fallback value
Throwsโ
When shouldThrow is true, or when shouldThrow is false but no fallbackValue is provided