Commit dc1f2cc4 authored by Luke Sandberg's avatar Luke Sandberg

consistently emit an issue instead of just a bail

parent d5170ebd
......@@ -29,13 +29,14 @@ pub enum ProcessResult {
#[turbo_tasks::value_impl]
impl ProcessResult {
#[turbo_tasks::function]
pub fn module(&self) -> Result<Vc<Box<dyn Module>>> {
pub async fn module(&self) -> Result<Vc<Box<dyn Module>>> {
match *self {
ProcessResult::Module(m) => Ok(*m),
ProcessResult::Ignore => {
bail!("Expected process result to be a module, but it was ignored")
}
ProcessResult::Unknown(_) => {
ProcessResult::Unknown(source) => {
emit_unknown_module_type_error(*source).await?;
bail!("Expected process result to be a module, but it could not be processed")
}
}
......
......@@ -70,11 +70,11 @@ pub async fn emit_unknown_module_type_error(source: Vc<Box<dyn Source>>) -> Resu
ModuleIssue {
ident: source.ident().to_resolved().await?,
title: StyledString::Text(rcstr!("Unknown module type")).resolved_cell(),
description: StyledString::Text(
description: StyledString::Text(rcstr!(
r"This module doesn't have an associated type. Use a known file extension, or register a loader for it.
Read more: https://nextjs.org/docs/app/api-reference/next-config-js/turbo#webpack-loaders".into(),
)
Read more: https://nextjs.org/docs/app/api-reference/next-config-js/turbo#webpack-loaders"
))
.resolved_cell(),
source: Some(IssueSource::from_source_only(source.to_resolved().await?)),
}
......
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