@@ -220,7 +220,6 @@ async function runWithFallback(code: string, options: ExecuteJavascriptOptions):
220220 const result = await freestyleEngine . execute ( code , options ) ;
221221 return Result . ok ( result ) ;
222222 } catch ( error ) {
223- //if we're here, that means infra error not user error?
224223 return Result . error ( error ) ;
225224 }
226225 } ,
@@ -232,8 +231,6 @@ async function runWithFallback(code: string, options: ExecuteJavascriptOptions):
232231 return retryResult . data ;
233232 }
234233
235- //TODO: Capture error block for freestyle engine infra failure?
236-
237234 captureError ( `js-execution-freestyle-failed` , new StackAssertionError (
238235 `JS execution freestyle engine failed, falling back to vercel sandbox engine` ,
239236 { error : retryResult . error , innerCode : code , innerOptions : options }
@@ -243,14 +240,11 @@ async function runWithFallback(code: string, options: ExecuteJavascriptOptions):
243240 const result = await vercelSandboxEngine . execute ( code , options ) ;
244241 return result ;
245242 } catch ( error ) {
246- //if we're here, that means infra error not user error?
247- //TODO: Improve error message?
248243 captureError ( `js-execution-vercel-sandbox-failed` , new StackAssertionError (
249244 `JS execution vercel sandbox engine failed after fallback from freestyle engine` ,
250245 { error : error , innerCode : code , innerOptions : options }
251246 ) ) ;
252- //TODO: Improve error message
253- throw new StackAssertionError ( "Infrastructure error" , { cause : error , innerCode : code , innerOptions : options } ) ;
247+ throw new StackAssertionError ( "Email rendering service unavailable" , { cause : error , innerCode : code , innerOptions : options } ) ;
254248 }
255249}
256250
@@ -260,7 +254,6 @@ async function runWithoutFallback(code: string, options: ExecuteJavascriptOption
260254 const result = await freestyleEngine . execute ( code , options ) ;
261255 return result ;
262256 } catch ( error ) {
263- //if we're here, that means infra error not user error?
264- throw new StackAssertionError ( "Infrastructure error" , { cause : error , innerCode : code , innerOptions : options } ) ;
257+ throw new StackAssertionError ( "Email rendering service unavailable" , { cause : error , innerCode : code , innerOptions : options } ) ;
265258 }
266259}
0 commit comments