diff --git a/src/hooks/use-site-details.tsx b/src/hooks/use-site-details.tsx index e2c0ac7f2..0258e5f94 100644 --- a/src/hooks/use-site-details.tsx +++ b/src/hooks/use-site-details.tsx @@ -279,21 +279,12 @@ export function SiteDetailsProvider( { children }: SiteDetailsProviderProps ) { updatedSite = await getIpcApi().startServer( id ); } catch ( error ) { Sentry.captureException( error ); - let errorToDisplay = error; - if ( - error instanceof Error && - error.message.includes( '"unreachable" WASM instruction executed' ) - ) { - errorToDisplay = new Error( - __( 'Please try disabling plugins and themes that might be causing the issue.' ) - ); - } getIpcApi().showErrorMessageBox( { title: __( 'Failed to start the site server' ), message: __( "Please verify your site's local path directory contains the standard WordPress installation files and try again. If this problem persists, please contact support." ), - error: errorToDisplay, + error, } ); await getIpcApi().stopServer( id ); } diff --git a/src/ipc-handlers.ts b/src/ipc-handlers.ts index 2c169cebc..d8dc95ace 100644 --- a/src/ipc-handlers.ts +++ b/src/ipc-handlers.ts @@ -388,7 +388,17 @@ export async function startServer( await keepSqliteIntegrationUpdated( server.details.path ); const parentWindow = BrowserWindow.fromWebContents( event.sender ); - await server.start(); + try { + await server.start(); + } catch ( error ) { + if ( + error instanceof Error && + error.message.includes( '"unreachable" WASM instruction executed' ) + ) { + throw new Error( 'Please try disabling plugins and themes that might be causing the issue.' ); + } + throw error; + } if ( parentWindow && ! parentWindow.isDestroyed() && ! event.sender.isDestroyed() ) { parentWindow.webContents.send( 'theme-details-changed', id, server.details.themeDetails ); }