Commit graph

42 commits

Author SHA1 Message Date
Bartek Iwańczuk 3f08a40412
refactor: add core.formatLocationFilename, remove op_format_filename (#14474)
This commit moves "op_format_location" to "core/ops_builtin.rs"
and removes "Deno.core.createPrepareStackTrace" in favor of
"Deno.core.prepareStackTrace".

Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-05-03 19:45:57 +02:00
Nayeem Rahman 9853c96cc4
refactor: Remove PrettyJsError and js_error_create_fn (#14378)
This commit:
- removes "fmt_errors::PrettyJsError" in favor of "format_js_error" fn
- removes "deno_core::JsError::create" and 
"deno_core::RuntimeOptions::js_error_create_fn"
- adds new option to "deno_runtime::ops::worker_host::init"
2022-04-27 01:06:10 +02:00
Nayeem Rahman c30d95f2e3
feat(ext/web): add globalThis.reportError() (#13799) 2022-04-19 10:59:51 +02:00
Bartek Iwańczuk a87be28a46
feat: Better formatting for AggregateError (#14285)
This commit adds "aggregated" field to "deno_core::JsError" that stores
instances of "JsError" recursively to properly handle "AggregateError"
formatting. Appropriate logics was added to "PrettyJsError" and
"console" API to format AggregateErrors.

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-04-16 16:12:26 +02:00
Nayeem Rahman 8b31fc23cd
refactor: Move source map lookups to core (#14274)
The following transformations gradually faced by "JsError" have all been 
moved up front to "JsError::from_v8_exception()": 

- finding the first non-"deno:" source line; 
- moving "JsError::script_resource_name" etc. into the first error stack 
in case of syntax errors; 
- source mapping "JsError::script_resource_name" etc. when wrapping 
the error even though the frame locations are source mapped earlier; 
- removing "JsError::{script_resource_name,line_number,start_column,end_column}"
entirely in favour of "js_error.frames.get(0)". 

We also no longer pass a js-side callback to "core/02_error.js" from cli. 
I avoided doing this on previous occasions because the source map lookups 
were in an awkward place.
2022-04-15 16:08:09 +02:00
Nayeem Rahman 7d50a5fd43
refactor(core/error): Clarify JsError message fields (#14269) 2022-04-13 16:41:39 +02:00
David Sherret ad224f53c7
chore: upgrade to rust 1.58 (#13377) 2022-01-15 07:10:12 +01:00
Ryan Dahl 1fb5858009
chore: update copyright to 2022 (#13306)
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2022-01-07 22:09:52 -05:00
Leo Kettmeir 167982be9e
feat: output cause on JS runtime errors (#13209) 2021-12-29 19:34:13 +01:00
Nayeem Rahman 5a48d41bdd
fix(cli/fmt_errors): don't panic on source line formatting errors (#12449)
Returns empty values in case of errors, source lines are non-essential anyway. These errors can happen e.g. when source files change at runtime. A warning is also printed to help us track when it happens in unexpected cases besides this.
2021-10-18 18:05:36 +02:00
Nayeem Rahman 75ca013f07
fix(cli/fmt_errors): Abbreviate long data URLs in stack traces (#12127)
Co-authored-by: Mike White <mike.white@auctane.com>
2021-09-18 15:40:04 +02:00
Ryan Dahl 13991e5995
refactor: Remove duplicated colors.rs file (#11990) 2021-09-12 12:04:17 -04:00
Yusuke Tanaka 8f00b5542c
chore: upgrade Rust to 1.54.0 (#11554) 2021-07-30 15:03:41 +02:00
Ryan Dahl 21ab4d94c0
fix(#10292): Don't gray-out internal frames (#10293) 2021-04-22 08:30:03 -04:00
Yusuke Tanaka d8fd71afdf
chore: update copyright to 2021 (#9092) 2021-01-11 18:13:41 +01:00
Nayeem Rahman ffb5f7a4e1
refactor: Rename runtime/rt to runtime/js (#8806) 2020-12-17 17:37:57 +01:00
Bartek Iwańczuk e582796f42
refactor(cli): rename fmt_errors::JsError to PrettyJsError (#8435)
This commit renames "fmt_errors::JsError" to "PrettyJsError"
to avoid confusion with "deno_core::JsError".

Consequently "CoreJsError" aliases to "deno_core::JsError"
were removed.

Additionally source mapping step has been removed from
"PrettyJsError::create" to better separate domains.
2020-11-19 20:37:22 +01:00
Kitson Kelly 7e2c7fb6c5
refactor(cli): migrate run and cache to new infrastructure (#7996)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-23 11:50:15 +11:00
Nayeem Rahman a43984c9cf
refactor(cli/fmt_errors): Color stack traces in Rust (#7628) 2020-09-22 19:01:30 +02:00
Bert Belder f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Bartek Iwańczuk f57a2c1e85
refactor(core): rename CoreIsolate to JsRuntime (#7373)
deno_core/
- rename core_isolate.rs to runtime.rs
- rename CoreIsolate to JsRuntime
- rename JSError to JsError
- rename JSStackFrame to JsStackFrame

cli/
- update references from deno_core::CoreIsolate to deno_core::JsRuntime
- rename deno_core::JSError to deno_core::JsError
- rename fmt_errors::JSError to fmt_errors::JsError
2020-09-06 21:44:29 +02:00
Bert Belder 9bfb0df805
refactor: remove OpError, use ErrBox everywhere (#7187)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-08-26 00:22:15 +02:00
Valentin Anger db36857288
refactor: util functions take slices instead of heap values (#6547) 2020-06-29 14:17:37 +02:00
Bartek Iwańczuk 0e9da7e731
feat: "deno lint" subcommand (#6125) 2020-06-08 14:06:20 +02:00
Bartek Iwańczuk 1fddcc3721
refactor(cli): unify display of errors from Rust and JS (#5183) 2020-05-09 21:09:46 +02:00
Nayeem Rahman 0f3e6e2eea
fix(cli/fmt_errors): Respect NO_COLOR for stack frames (#5051) 2020-05-02 23:55:16 -04:00
Fenzland 25b765c123
fix misaligned error reporting on tab char (#5032) 2020-05-01 13:03:54 -04:00
Nayeem Rahman ef6ee25e09
refactor(cli/fmt_errors): Improve source line formatting (#4832) 2020-04-20 15:39:02 -04:00
Nayeem Rahman 0ea6eb83a9
refactor(core/js_error): Align JSStackFrame with CallSite (#4715)
Renames and adds missing fields to JSStackFrame from CallSite. Fixes #4705.

Cleans up base changes for line and column numbers.
2020-04-13 10:54:16 -04:00
Nayeem Rahman 2b362bef85
refactor(cli/fmt_errors): Format stack frames in prepareStackTrace() (#4706) 2020-04-11 02:08:11 -04:00
Nayeem Rahman 8b4508338b
fix(core/js_error): Get frame data from prepareStackTrace() (#4690)
Fixes: #2703
Fixes: #2710
Closes: #4153
Closes: #4232

Co-authored-by: Kevin (Kun) Kassimo Qian <kevinkassimo@gmail.com>
2020-04-10 18:26:52 +02:00
Kitson Kelly f527407287
clippy (#4618) 2020-04-03 22:41:16 -04:00
Kevin (Kun) "Kassimo" Qian 3d228f5f9e
hide source line if error message longer than 150 chars (#4487) 2020-03-24 23:53:48 -04:00
Bert Belder eafd40feab
Do not convert exceptions to JSON and back (#4214) 2020-03-02 14:20:16 -08:00
Kevin (Kun) "Kassimo" Qian c3661e9f07
Make internel error frames dimmer (#4201) 2020-03-01 16:17:44 -05:00
Bartek Iwańczuk 5fa056e53b workers: minimal error handling and async module loading (#3665) 2020-01-17 18:43:53 -05:00
Ry Dahl 76e44ddfd0
Rename crates: 'deno' to 'deno_core' and 'deno_cli' to 'deno' (#3600) 2020-01-05 11:56:18 -05:00
Ry Dahl bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
Axetroy 3bb15ceaea Upgrades rust to 1.40.0 (#3542) 2019-12-23 09:59:44 -05:00
Tomohito Nakayama a93b29007f Rename ansi.rs to colors.rs (#2956) 2019-09-15 14:48:25 -04:00
Bert Belder abe8a113ad Refactor error to use dynamic dispatch and traits
This is in preperation for dynamic import (#1789), which is more easily
implemented when errors are dynamic.
2019-07-11 14:37:00 -04:00
Kitson Kelly 425df50484 Combine CLI Errors (#2487) 2019-06-19 19:07:01 -07:00