diff options
Diffstat (limited to 'cli/deno_error.rs')
-rw-r--r-- | cli/deno_error.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/deno_error.rs b/cli/deno_error.rs index 2066d9c52..eb885adb8 100644 --- a/cli/deno_error.rs +++ b/cli/deno_error.rs @@ -22,6 +22,17 @@ pub struct DenoError { msg: String, } +pub fn print_err_and_exit(err: ErrBox) { + eprintln!("{}", err.to_string()); + std::process::exit(1); +} + +pub fn js_check(r: Result<(), ErrBox>) { + if let Err(err) = r { + print_err_and_exit(err); + } +} + impl DenoError { pub fn new(kind: ErrorKind, msg: String) -> Self { Self { kind, msg } |