File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/app/src/cli/services/build Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -186,9 +186,16 @@ export async function buildFunctionExtension(
186186 await touchFile ( bundlePath )
187187 await writeFile ( bundlePath , base64Contents )
188188 }
189- } catch ( error ) {
189+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
190+ } catch ( error : any ) {
191+ // We capture and rethrow as AbortError to avoid random user-code errors being reported as CLI bugs.
192+ // At the same time, we need to keep the ESBuild details for the logs. (the `errors` array)
190193 const errorMessage = ( error as Error ) . message ?? 'Unknown error occurred'
191- throw new AbortError ( 'Failed to build function.' , errorMessage )
194+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
195+ const newError : any = new AbortError ( 'Failed to build function.' , errorMessage )
196+ // Inject ESBuild errors if present
197+ newError . errors = error . errors
198+ throw newError
192199 } finally {
193200 await releaseLock ( )
194201 }
You can’t perform that action at this time.
0 commit comments