diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bd764e6ef2f..813856146ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ Before sending a pull request, make sure to do the following: _Please reach out to the marimo team before starting work on a large contribution._ Get in touch at -[Github issues](https://github.com/marimo-team/marimo/issues) +[GitHub issues](https://github.com/marimo-team/marimo/issues) or [on Discord](https://discord.gg/JE7nhX6mD8). ## Building from source diff --git a/docs/getting_started/index.md b/docs/getting_started/index.md index e06c1483f40..142b86d8b1f 100644 --- a/docs/getting_started/index.md +++ b/docs/getting_started/index.md @@ -58,7 +58,7 @@ A tutorial notebook should open in your browser. ```{admonition} Installation issues? -Having installation issues? Reach out to us [at Github](https://github.com/marimo-team/marimo/issues) or [on Discord](https://discord.gg/JE7nhX6mD8). +Having installation issues? Reach out to us [at GitHub](https://github.com/marimo-team/marimo/issues) or [on Discord](https://discord.gg/JE7nhX6mD8). ``` ## Tutorials diff --git a/frontend/public/files/wasm-intro.py b/frontend/public/files/wasm-intro.py index 4ee0f21f45c..65aa8ada360 100644 --- a/frontend/public/files/wasm-intro.py +++ b/frontend/public/files/wasm-intro.py @@ -346,7 +346,7 @@ def __(mo): ``` In addition to tutorials, we have examples in our - [our Github repo](https://www.github.com/marimo-team/marimo/tree/main/examples). + [our GitHub repo](https://www.github.com/marimo-team/marimo/tree/main/examples). """ ) return diff --git a/frontend/src/components/editor/boundary/ErrorBoundary.tsx b/frontend/src/components/editor/boundary/ErrorBoundary.tsx index da0343a61ef..f3f43923013 100644 --- a/frontend/src/components/editor/boundary/ErrorBoundary.tsx +++ b/frontend/src/components/editor/boundary/ErrorBoundary.tsx @@ -5,6 +5,7 @@ import { FallbackProps, } from "react-error-boundary"; import { Button } from "../../ui/button"; +import { Constants } from "@/core/constants"; export const ErrorBoundary: React.FC = (props) => { return ( @@ -14,14 +15,25 @@ export const ErrorBoundary: React.FC = (props) => { ); }; -export const container = - "flex-1 flex items-center justify-center flex-col space-y-4"; - const FallbackComponent: React.FC = (props) => { return ( -
-

Something went wrong

-

{props.error?.message}

+
+

Something went wrong

+
+        {props.error?.message}
+      
+
+ If this is an issue with marimo, please report it on{" "} + + GitHub + + . +
diff --git a/frontend/src/core/MarimoApp.tsx b/frontend/src/core/MarimoApp.tsx index 768e75a3f55..1de0ef30c6e 100644 --- a/frontend/src/core/MarimoApp.tsx +++ b/frontend/src/core/MarimoApp.tsx @@ -84,7 +84,7 @@ export const PyodideLoader: React.FC = ({ children }) => { // isPyodide() is constant, so this is safe // eslint-disable-next-line react-hooks/rules-of-hooks - const { loading } = useAsyncData(async () => { + const { loading, error } = useAsyncData(async () => { await PyodideBridge.INSTANCE.initialized.promise; return true; }, []); @@ -93,5 +93,10 @@ export const PyodideLoader: React.FC = ({ children }) => { return ; } + // Propagate back up to our error boundary + if (error) { + throw error; + } + return children; }; diff --git a/frontend/src/core/pyodide/bridge.ts b/frontend/src/core/pyodide/bridge.ts index 3b7b78fb504..4af9e30563a 100644 --- a/frontend/src/core/pyodide/bridge.ts +++ b/frontend/src/core/pyodide/bridge.ts @@ -110,6 +110,9 @@ export class PyodideBridge implements RunRequests, EditRequests { if (event.data.type === "initialized") { this.initialized.resolve(); } + if (event.data.type === "initialized-error") { + this.initialized.reject(new Error(event.data.error)); + } if (event.data.type === "message") { this.messageConsumer?.(event.data.message); } @@ -286,9 +289,7 @@ export class PyodideBridge implements RunRequests, EditRequests { }; sendFunctionRequest = async (request: SendFunctionRequest): Promise => { - await this.putControlRequest({ - function_call: request, - }); + await this.putControlRequest(request); return null; }; diff --git a/frontend/src/core/pyodide/worker/types.ts b/frontend/src/core/pyodide/worker/types.ts index 4d385248f2b..6c201d578ae 100644 --- a/frontend/src/core/pyodide/worker/types.ts +++ b/frontend/src/core/pyodide/worker/types.ts @@ -77,6 +77,10 @@ export type WorkerClientPayload = | { type: "initialized"; } + | { + type: "initialized-error"; + error: string; + } | { type: "error"; id: RequestId; diff --git a/frontend/src/core/pyodide/worker/worker.ts b/frontend/src/core/pyodide/worker/worker.ts index 5594a7370cb..9b5c59b0049 100644 --- a/frontend/src/core/pyodide/worker/worker.ts +++ b/frontend/src/core/pyodide/worker/worker.ts @@ -12,6 +12,7 @@ import { invariant } from "../../../utils/invariant"; import { Deferred } from "../../../utils/Deferred"; import { syncFileSystem } from "./fs"; import { MessageBuffer } from "./message-buffer"; +import { prettyError } from "../../../utils/errors"; declare const self: Window & { pyodide: PyodideInterface; @@ -21,7 +22,12 @@ declare const self: Window & { async function loadPyodideAndPackages() { // @ts-expect-error ehh TypeScript await import("https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pyodide.js"); - self.pyodide = await bootstrap(); + try { + self.pyodide = await bootstrap(); + } catch (error) { + console.error("Error bootstrapping", error); + postMessage({ type: "initialized-error", error: prettyError(error) }); + } } const pyodideReadyPromise = loadPyodideAndPackages(); const messageBuffer = new MessageBuffer((m: string) => diff --git a/frontend/src/plugins/impl/common/error-banner.tsx b/frontend/src/plugins/impl/common/error-banner.tsx index 93463d84f73..cbbbf765dd2 100644 --- a/frontend/src/plugins/impl/common/error-banner.tsx +++ b/frontend/src/plugins/impl/common/error-banner.tsx @@ -37,11 +37,13 @@ export const ErrorBanner = ({ {message} - + Error -
{message}
+
+            {message}
+          
setOpen(false)}> Ok diff --git a/marimo/_messaging/ops.py b/marimo/_messaging/ops.py index 5929eea07e9..7e1e67e4bf9 100644 --- a/marimo/_messaging/ops.py +++ b/marimo/_messaging/ops.py @@ -105,7 +105,7 @@ def maybe_truncate_output( Increasing the max output size may cause performance issues. If you run into problems, please reach out to us on [Discord](https://discord.gg/JE7nhX6mD8) or - [Github](https://github.com/marimo-team/marimo/issues). + [GitHub](https://github.com/marimo-team/marimo/issues). """ warning = callout( diff --git a/marimo/_server/sessions.py b/marimo/_server/sessions.py index 8a4f5e95feb..5f7daa48ad6 100644 --- a/marimo/_server/sessions.py +++ b/marimo/_server/sessions.py @@ -605,7 +605,7 @@ def start(self) -> Optional[Alert]: if binpath is None: LOGGER.error("Node.js not found; cannot start LSP server.") return Alert( - title="Github Copilot: Connection Error", + title="GitHub Copilot: Connection Error", description="Install Node.js to use copilot.", # noqa: E501 variant="danger", ) diff --git a/marimo/_tutorials/intro.py b/marimo/_tutorials/intro.py index ef211af05c9..f47002c868d 100644 --- a/marimo/_tutorials/intro.py +++ b/marimo/_tutorials/intro.py @@ -298,7 +298,7 @@ def __(mo): ``` In addition to tutorials, we have examples in our - [our Github repo](https://www.github.com/marimo-team/marimo/tree/main/examples). + [our GitHub repo](https://www.github.com/marimo-team/marimo/tree/main/examples). """ ) return