MCPcopy
hub / github.com/Crosstalk-Solutions/project-nomad / catchInternal

Function catchInternal

admin/inertia/lib/util.ts:73–92  ·  view source on GitHub ↗
(fn: Fn)

Source from the content-addressed store, hash-verified

71 * @returns A new function that executes the original function and logs any errors. Returns undefined in case of an error.
72 */
73export function catchInternal<Fn extends (...args: any[]) => any>(fn: Fn): (...args: Parameters<Fn>) => Promise<ReturnType<Fn> | undefined> {
74 return async (...args: any[]) => {
75 try {
76 return await fn(...args)
77 } catch (error) {
78 console.error('Internal error caught:', error)
79
80 if (globalNotificationCallback) {
81 const errorMessage = 'An internal error occurred. Please try again or check the console for details. ' + (error instanceof Error ? String(error.message).slice(0, 50) : '')
82 globalNotificationCallback({
83 message: errorMessage,
84 type: 'error',
85 duration: 5000
86 })
87 }
88
89 return undefined
90 }
91 }
92}

Callers 15

checkLatestVersionMethod · 0.90
getRemoteOllamaStatusMethod · 0.90
configureRemoteOllamaMethod · 0.90
deleteModelMethod · 0.90
downloadBaseMapAssetsMethod · 0.90
downloadMapCollectionMethod · 0.90
downloadModelMethod · 0.90
downloadCategoryTierMethod · 0.90
deleteMapRegionFileMethod · 0.90
downloadRemoteZimFileMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected