Skip to content

Commit

Permalink
chore: test error stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 5, 2024
1 parent 7383573 commit 48dce18
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/child-process/src/entry-rsc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import Page from "./routes/page";
export type StreamData = React.ReactNode;

export default function handler(request: Request) {
const url = new URL(request.url);
if (url.searchParams.has("crash-rsc-handler")) {
throw new Error("boom");
}
const root = (
<html>
<head></head>
<body>
<pre>url: {request.url}</pre>
<Page />
<Page url={url} />
</body>
</html>
);
Expand Down
8 changes: 8 additions & 0 deletions examples/child-process/src/entry-ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import type { StreamData } from "./entry-rsc";

export default async function handler(request: Request): Promise<Response> {
const url = new URL(request.url);
if (url.searchParams.has("crash-ssr-handler")) {
throw new Error("boom");
}

const response = await handleRsc(request);
if (!response.ok) {
return response;
}

if (url.searchParams.has("__f")) {
return response;
}
Expand Down
5 changes: 4 additions & 1 deletion examples/child-process/src/routes/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export default function Page() {
export default async function Page(props: { url: URL }) {
if (props.url.searchParams.has("crash-rsc-page")) {
throw new Error("boom");
}
return (
<div>
<meta name="bun-version" content={Bun.version} />
Expand Down

0 comments on commit 48dce18

Please sign in to comment.