Unverified Commit 2abc8248 authored by Justin Ridgewell's avatar Justin Ridgewell Committed by GitHub

Turbopack: Use `SharedError` for body streaming (#47677)

Pending https://github.com/vercel/turbo/pull/4392 landing in Turbopack (and https://github.com/vercel/next.js/pull/47476 landing here), this removes `BodyError` and switches to `SharedError`. That should allow us to preserve the source chain of errors for when we finally display it to the dev, aiding debugging.
parent f978e700
This diff is collapsed.
......@@ -47,11 +47,11 @@ swc_emotion = { version = "0.29.10" }
testing = { version = "0.31.31" }
# Turbo crates
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230331.2" }
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230331.3" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230331.2" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230331.3" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230331.2" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230331.3" }
# General Deps
......
......@@ -120,7 +120,7 @@ enum RouterIncomingMessage {
Error { error: StructuredError },
}
#[turbo_tasks::value(eq = "manual", cell = "new", serialization = "none")]
#[turbo_tasks::value]
#[derive(Debug, Clone, Default)]
pub struct MiddlewareResponse {
pub status_code: u16,
......@@ -129,8 +129,8 @@ pub struct MiddlewareResponse {
pub body: Stream<Result<Bytes, SharedError>>,
}
#[turbo_tasks::value(eq = "manual", cell = "new", serialization = "none")]
#[derive(Debug)]
#[turbo_tasks::value]
pub enum RouterResult {
Rewrite(RewriteResponse),
Middleware(MiddlewareResponse),
......
......@@ -7,9 +7,9 @@ use turbo_binding::turbopack::{
introspect::{Introspectable, IntrospectableChildrenVc, IntrospectableVc},
},
dev_server::source::{
Body, BodyError, ContentSource, ContentSourceContent, ContentSourceData,
ContentSourceDataVary, ContentSourceResultVc, ContentSourceVc, HeaderListVc, NeededData,
ProxyResult, RewriteBuilder,
Body, ContentSource, ContentSourceContent, ContentSourceData, ContentSourceDataVary,
ContentSourceResultVc, ContentSourceVc, HeaderListVc, NeededData, ProxyResult,
RewriteBuilder,
},
node::execution_context::ExecutionContextVc,
};
......@@ -156,11 +156,7 @@ impl ContentSource for NextRouterContentSource {
ProxyResult {
status: data.status_code,
headers: data.headers.clone(),
body: Body::from_stream(data.body.read().map(|chunk| {
chunk.map_err(|e| {
BodyError::new(format!("error streaming proxied contents: {}", e))
})
})),
body: Body::from_stream(data.body.read()),
}
.cell(),
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment