Skip to content

Commit 1209d9f

Browse files
committed
improve error
1 parent 55bf80b commit 1209d9f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/next-core/src/util.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ pub async fn load_next_js_json_file<T: DeserializeOwned>(
299299

300300
match content.parse_json_ref() {
301301
FileJsonContent::Unparsable(e) => Err(anyhow!("File is not valid JSON: {}", e)),
302-
FileJsonContent::NotFound => Err(anyhow!("File not found")),
302+
FileJsonContent::NotFound => Err(anyhow!(
303+
"File not found: {:?}",
304+
file_path.value_to_string().await?
305+
)),
303306
FileJsonContent::Content(value) => Ok(serde_json::from_value(value)?),
304307
}
305308
}
@@ -316,7 +319,10 @@ pub async fn load_next_js_jsonc_file<T: DeserializeOwned>(
316319

317320
match content.parse_json_with_comments_ref() {
318321
FileJsonContent::Unparsable(e) => Err(anyhow!("File is not valid JSON: {}", e)),
319-
FileJsonContent::NotFound => Err(anyhow!("File not found")),
322+
FileJsonContent::NotFound => Err(anyhow!(
323+
"File not found: {:?}",
324+
file_path.value_to_string().await?
325+
)),
320326
FileJsonContent::Content(value) => Ok(serde_json::from_value(value)?),
321327
}
322328
}

0 commit comments

Comments
 (0)