1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

refactor(core): remove Deno.core.formatError() (#8091)

With recent improvements to REPL implementation,
Deno.core.formatError() API is no longer needed.
This commit is contained in:
Bartek Iwańczuk 2020-10-23 22:16:12 +02:00 committed by GitHub
parent 9d36331278
commit 8d95bd15e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use crate::error::AnyError;
use crate::error::JsError;
use crate::runtime::JsRuntimeState;
use crate::JsRuntime;
use crate::Op;
@ -34,9 +33,6 @@ lazy_static! {
v8::ExternalReference {
function: eval_context.map_fn_to()
},
v8::ExternalReference {
function: format_error.map_fn_to()
},
v8::ExternalReference {
getter: shared_getter.map_fn_to()
},
@ -158,11 +154,6 @@ pub fn initialize_context<'s>(
let eval_context_val = eval_context_tmpl.get_function(scope).unwrap();
core_val.set(scope, eval_context_key.into(), eval_context_val.into());
let format_error_key = v8::String::new(scope, "formatError").unwrap();
let format_error_tmpl = v8::FunctionTemplate::new(scope, format_error);
let format_error_val = format_error_tmpl.get_function(scope).unwrap();
core_val.set(scope, format_error_key.into(), format_error_val.into());
let encode_key = v8::String::new(scope, "encode").unwrap();
let encode_tmpl = v8::FunctionTemplate::new(scope, encode);
let encode_val = encode_tmpl.get_function(scope).unwrap();
@ -602,20 +593,6 @@ fn eval_context(
rv.set(output.into());
}
fn format_error(
scope: &mut v8::HandleScope,
args: v8::FunctionCallbackArguments,
mut rv: v8::ReturnValue,
) {
let e = JsError::from_v8_exception(scope, args.get(0));
let state_rc = JsRuntime::state(scope);
let state = state_rc.borrow();
let e = (state.js_error_create_fn)(e);
let e = e.to_string();
let e = v8::String::new(scope, &e).unwrap();
rv.set(e.into())
}
fn encode(
scope: &mut v8::HandleScope,
args: v8::FunctionCallbackArguments,