summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index f2e241ab1..cdb7d8dd0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,6 +10,8 @@ extern crate rand;
extern crate remove_dir_all;
extern crate ring;
extern crate rustyline;
+extern crate serde_json;
+extern crate source_map_mappings;
extern crate tempfile;
extern crate tokio;
extern crate tokio_executor;
@@ -33,6 +35,7 @@ mod fs;
mod http_body;
mod http_util;
pub mod isolate;
+pub mod js_errors;
pub mod libdeno;
pub mod msg;
pub mod msg_util;
@@ -68,6 +71,13 @@ impl log::Log for Logger {
fn flush(&self) {}
}
+fn print_err_and_exit(err: js_errors::JSError) {
+ // TODO Currently tests depend on exception going to stdout. It should go
+ // to stderr. https://github.com/denoland/deno/issues/964
+ println!("{}", err.to_string());
+ std::process::exit(1);
+}
+
fn main() {
// Rust does not die on panic by default. And -Cpanic=abort is broken.
// https://github.com/rust-lang/cargo/issues/2738
@@ -102,10 +112,7 @@ fn main() {
tokio_util::init(|| {
isolate
.execute("deno_main.js", "denoMain();")
- .unwrap_or_else(|err| {
- error!("{}", err);
- std::process::exit(1);
- });
- isolate.event_loop();
+ .unwrap_or_else(print_err_and_exit);
+ isolate.event_loop().unwrap_or_else(print_err_and_exit);
});
}