mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
fix(cli/bundle): display anyhow error chain (#9822)
This commit is contained in:
parent
7d12dd1899
commit
277e19f4d2
5 changed files with 19 additions and 7 deletions
|
@ -1158,13 +1158,7 @@ fn unwrap_or_exit<T>(result: Result<T, AnyError>) -> T {
|
||||||
match result {
|
match result {
|
||||||
Ok(value) => value,
|
Ok(value) => value,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
let msg = format!(
|
eprintln!("{}: {:?}", colors::red_bold("error"), error);
|
||||||
"{}: {}",
|
|
||||||
colors::red_bold("error"),
|
|
||||||
// TODO(lucacasonato): print anyhow error chain here
|
|
||||||
error.to_string().trim()
|
|
||||||
);
|
|
||||||
eprintln!("{}", msg);
|
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
cli/tests/error_027_bare_import_error.ts
Normal file
1
cli/tests/error_027_bare_import_error.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
import "foo";
|
8
cli/tests/error_027_bare_import_error.ts.out
Normal file
8
cli/tests/error_027_bare_import_error.ts.out
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[WILDCARD]error: Unable to output bundle during Graph::bundle().
|
||||||
|
|
||||||
|
Caused by:
|
||||||
|
0: load_transformed failed
|
||||||
|
1: failed to analyze module
|
||||||
|
2: failed to resolve foo from <file:///[WILDCARD]/error_027_bare_import_error.ts>
|
||||||
|
3: The graph is missing a dependency.
|
||||||
|
Specifier: foo from file:///[WILDCARD]/error_027_bare_import_error.ts
|
|
@ -1 +1,4 @@
|
||||||
error: invalid URL: relative URL with a cannot-be-a-base base
|
error: invalid URL: relative URL with a cannot-be-a-base base
|
||||||
|
|
||||||
|
Caused by:
|
||||||
|
relative URL with a cannot-be-a-base base
|
||||||
|
|
|
@ -3148,6 +3148,12 @@ console.log("finish");
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itest!(error_027_bare_import_error {
|
||||||
|
args: "bundle error_027_bare_import_error.ts",
|
||||||
|
output: "error_027_bare_import_error.ts.out",
|
||||||
|
exit_code: 1,
|
||||||
|
});
|
||||||
|
|
||||||
itest!(error_missing_module_named_import {
|
itest!(error_missing_module_named_import {
|
||||||
args: "run --reload error_missing_module_named_import.ts",
|
args: "run --reload error_missing_module_named_import.ts",
|
||||||
output: "error_missing_module_named_import.ts.out",
|
output: "error_missing_module_named_import.ts.out",
|
||||||
|
|
Loading…
Reference in a new issue