Better spawn error message (#1434)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Structure preview errors with source-aware messaging/UI and enhance
local/Docker spawn error diagnostics and logging.
>
> - **Frontend**:
> - **Error model**: Change `previewErrorMessageAtom` from `string` to
`{ message, source }` to distinguish `preview-app` vs `dyad-app` errors.
> - **Preview UI**: Update `ErrorBanner` in
`components/preview_panel/PreviewIframe.tsx` to use `error.message`,
show an "Internal Dyad error" chip for `dyad-app`, conditional tip text,
and hide AI fix for non-`preview-app` errors; use `cn` helper.
> - **Error propagation**: Wrap iframe and build errors via
`setErrorMessage({ message, source: "preview-app" })`; adjust AI prompt
to use `errorMessage.message`.
> - **Hooks**:
> - `useRunApp`: On run/stop/restart failures, set `{ message, source:
"dyad-app" }` in `previewErrorMessageAtom`.
> - **Backend**:
> - `ipc/handlers/app_handlers.ts`: Improve spawn failure handling for
local node and Docker: capture stderr as strings, collect error details
(`message`, `code`, `errno`, `syscall`, `path`, `spawnargs`), log with
context, and throw enriched error messages.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4135b04e19431dd53848c3266e5211e4c9df6aa2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
@@ -104,7 +104,12 @@ export function useRunApp() {
|
||||
} catch (error) {
|
||||
console.error(`Error running app ${appId}:`, error);
|
||||
setPreviewErrorMessage(
|
||||
error instanceof Error ? error.message : error?.toString(),
|
||||
error instanceof Error
|
||||
? { message: error.message, source: "dyad-app" }
|
||||
: {
|
||||
message: error?.toString() || "Unknown error",
|
||||
source: "dyad-app",
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -127,7 +132,12 @@ export function useRunApp() {
|
||||
} catch (error) {
|
||||
console.error(`Error stopping app ${appId}:`, error);
|
||||
setPreviewErrorMessage(
|
||||
error instanceof Error ? error.message : error?.toString(),
|
||||
error instanceof Error
|
||||
? { message: error.message, source: "dyad-app" }
|
||||
: {
|
||||
message: error?.toString() || "Unknown error",
|
||||
source: "dyad-app",
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -186,7 +196,12 @@ export function useRunApp() {
|
||||
} catch (error) {
|
||||
console.error(`Error restarting app ${appId}:`, error);
|
||||
setPreviewErrorMessage(
|
||||
error instanceof Error ? error.message : error?.toString(),
|
||||
error instanceof Error
|
||||
? { message: error.message, source: "dyad-app" }
|
||||
: {
|
||||
message: error?.toString() || "Unknown error",
|
||||
source: "dyad-app",
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
setPreviewPanelKey((prevKey) => prevKey + 1);
|
||||
|
||||
Reference in New Issue
Block a user