1
0
Fork 0
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:
Andrew Mitchell 2021-03-18 20:02:29 -04:00 committed by GitHub
parent 7d12dd1899
commit 277e19f4d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 7 deletions

View file

@ -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);
} }
} }

View file

@ -0,0 +1 @@
import "foo";

View 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

View file

@ -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

View file

@ -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",