| 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<StyledString>, |
| pub status: Option<i32>, |
| } |
|
|
| #[turbo_tasks::value_impl] |
| impl Issue for RenderingIssue { |
| #[turbo_tasks::function] |
| fn title(&self) -> Vc<StyledString> { |
| StyledString::Text(rcstr!("Error during SSR Rendering")).cell() |
| } |
|
|
| #[turbo_tasks::function] |
| fn stage(&self) -> Vc<IssueStage> { |
| IssueStage::CodeGen.cell() |
| } |
|
|
| #[turbo_tasks::function] |
| fn file_path(&self) -> Vc<FileSystemPath> { |
| self.file_path.clone().cell() |
| } |
|
|
| #[turbo_tasks::function] |
| fn description(&self) -> Vc<OptionStyledString> { |
| Vc::cell(Some(self.message)) |
| } |
|
|
| #[turbo_tasks::function] |
| fn detail(&self) -> Vc<OptionStyledString> { |
| 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())) |
| } |
|
|
| |
| } |
|
|