mirror of
https://github.com/denoland/deno.git
synced 2024-11-01 09:24:20 -04:00
3f08a40412
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>
21 lines
571 B
Rust
21 lines
571 B
Rust
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
|
|
|
use crate::diagnostics::Diagnostics;
|
|
use deno_core::error::AnyError;
|
|
use deno_core::op;
|
|
use deno_core::serde_json;
|
|
use deno_core::serde_json::json;
|
|
use deno_core::serde_json::Value;
|
|
use deno_core::Extension;
|
|
|
|
pub fn init() -> Extension {
|
|
Extension::builder()
|
|
.ops(vec![op_format_diagnostic::decl()])
|
|
.build()
|
|
}
|
|
|
|
#[op]
|
|
fn op_format_diagnostic(args: Value) -> Result<Value, AnyError> {
|
|
let diagnostic: Diagnostics = serde_json::from_value(args)?;
|
|
Ok(json!(diagnostic.to_string()))
|
|
}
|