Skip to content

Commit

Permalink
update also the message that is logged in Studio log
Browse files Browse the repository at this point in the history
  • Loading branch information
sejas committed Dec 20, 2024
1 parent 53bb6cb commit 1a030ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 1 addition & 10 deletions src/hooks/use-site-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
12 changes: 11 additions & 1 deletion src/ipc-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down

0 comments on commit 1a030ef

Please sign in to comment.