MCPcopy
hub / github.com/simstudioai/sim / dispatchWithFallback

Function dispatchWithFallback

apps/sim/lib/messaging/email/mailer.ts:105–120  ·  view source on GitHub ↗
(data: ProcessedEmailData)

Source from the content-addressed store, hash-verified

103}
104
105async function dispatchWithFallback(data: ProcessedEmailData): Promise<SendEmailResult> {
106 let lastError: unknown
107 for (const provider of activeProviders) {
108 try {
109 return await provider.send(data)
110 } catch (error) {
111 lastError = error
112 logger.warn(`${provider.name} failed, trying next provider`, error)
113 }
114 }
115 logger.error('All email providers failed', lastError)
116 return {
117 success: false,
118 message: `All email providers failed: ${getErrorMessage(lastError, 'unknown error')}`,
119 }
120}
121
122interface PreparedBatchEntry {
123 index: number

Callers 1

sendEmailFunction · 0.85

Calls 4

getErrorMessageFunction · 0.90
sendMethod · 0.80
errorMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected