use turbo_rcstr::rcstr; use turbo_tasks::{ResolvedVc, Vc}; use turbo_tasks_fs::FileSystemPath; use turbopack_core::issue::{Issue, IssueStage, OptionStyledString, StyledString}; #[turbo_tasks::value(shared)] #[derive(Clone)] pub struct RenderingIssue { pub file_path: FileSystemPath, pub message: ResolvedVc, pub status: Option, } #[turbo_tasks::value_impl] impl Issue for RenderingIssue { #[turbo_tasks::function] fn title(&self) -> Vc { StyledString::Text(rcstr!("Error during SSR Rendering")).cell() } #[turbo_tasks::function] fn stage(&self) -> Vc { IssueStage::CodeGen.cell() } #[turbo_tasks::function] fn file_path(&self) -> Vc { self.file_path.clone().cell() } #[turbo_tasks::function] fn description(&self) -> Vc { Vc::cell(Some(self.message)) } #[turbo_tasks::function] fn detail(&self) -> Vc { let mut details = vec![]; if let Some(status) = self.status && status != 0 { details.push(StyledString::Text( format!("Node.js exit code: {status}").into(), )); } Vc::cell(Some(StyledString::Stack(details).resolved_cell())) } // TODO parse stack trace into source location }