mirror of
https://github.com/denoland/deno.git
synced 2025-01-14 10:01:51 -05:00
Better exception output.
This commit is contained in:
parent
3e51605bc9
commit
b892188878
5 changed files with 16 additions and 9 deletions
10
BUILD.gn
10
BUILD.gn
|
@ -24,7 +24,10 @@ config("deno_config") {
|
||||||
|
|
||||||
rust_executable("deno") {
|
rust_executable("deno") {
|
||||||
source_root = "src/main.rs"
|
source_root = "src/main.rs"
|
||||||
extern = [ "$rust_build:libc" ]
|
extern = [
|
||||||
|
"$rust_build:libc",
|
||||||
|
"$rust_build:log",
|
||||||
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":libdeno",
|
":libdeno",
|
||||||
]
|
]
|
||||||
|
@ -35,7 +38,10 @@ rust_executable("deno") {
|
||||||
# extra process of building a snapshot and instead load the bundle from disk.
|
# extra process of building a snapshot and instead load the bundle from disk.
|
||||||
rust_executable("deno_nosnapshot") {
|
rust_executable("deno_nosnapshot") {
|
||||||
source_root = "src/main.rs"
|
source_root = "src/main.rs"
|
||||||
extern = [ "$rust_build:libc" ]
|
extern = [
|
||||||
|
"$rust_build:libc",
|
||||||
|
"$rust_build:log",
|
||||||
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":libdeno_nosnapshot",
|
":libdeno_nosnapshot",
|
||||||
]
|
]
|
||||||
|
|
|
@ -36,7 +36,7 @@ window.onerror = (
|
||||||
// Error.prepareStackTrace handler. Users will get unmapped stack traces on
|
// Error.prepareStackTrace handler. Users will get unmapped stack traces on
|
||||||
// uncaught exceptions until this issue is fixed.
|
// uncaught exceptions until this issue is fixed.
|
||||||
//Error.prepareStackTrace = null;
|
//Error.prepareStackTrace = null;
|
||||||
console.log(error.message, error.stack);
|
console.log(error.stack);
|
||||||
os.exit(1);
|
os.exit(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ export function log(...args: any[]): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assert(cond: boolean, msg = "") {
|
export function assert(cond: boolean, msg = "assert") {
|
||||||
if (!cond) {
|
if (!cond) {
|
||||||
throw Error(`Assert fail. ${msg}`);
|
throw Error(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,9 +177,6 @@ pub extern "C" fn handle_code_fetch(
|
||||||
module_specifier_: *const c_char,
|
module_specifier_: *const c_char,
|
||||||
containing_file_: *const c_char,
|
containing_file_: *const c_char,
|
||||||
) {
|
) {
|
||||||
// TODO(ry) Move this to main.
|
|
||||||
log::set_max_level(log::LevelFilter::Debug);
|
|
||||||
|
|
||||||
let module_specifier = string_from_ptr(module_specifier_);
|
let module_specifier = string_from_ptr(module_specifier_);
|
||||||
let containing_file = string_from_ptr(containing_file_);
|
let containing_file = string_from_ptr(containing_file_);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
|
||||||
use libc::c_char;
|
use libc::c_char;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
@ -107,6 +109,8 @@ impl Drop for Deno {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
log::set_max_level(log::LevelFilter::Debug);
|
||||||
|
|
||||||
unsafe { deno_init() };
|
unsafe { deno_init() };
|
||||||
|
|
||||||
set_flags();
|
set_flags();
|
||||||
|
@ -122,7 +126,7 @@ fn main() {
|
||||||
|
|
||||||
d.execute("deno_main.js", "denoMain();")
|
d.execute("deno_main.js", "denoMain();")
|
||||||
.unwrap_or_else(|err| {
|
.unwrap_or_else(|err| {
|
||||||
println!("Error {}\n", err);
|
error!("{}", err);
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue