From 8d95bd15e14a576c45ceadd030d70de43d758379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 23 Oct 2020 22:16:12 +0200 Subject: [PATCH] refactor(core): remove Deno.core.formatError() (#8091) With recent improvements to REPL implementation, Deno.core.formatError() API is no longer needed. --- core/bindings.rs | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/core/bindings.rs b/core/bindings.rs index 071d6e015f..4b2c398815 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -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,