mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 04:39:10 +00:00
Revert json ops (#2814)
* Revert "port more ops to JSON (#2809)" This reverts commit137f33733d
. * Revert "port ops to JSON: compiler, errors, fetch, files (#2804)" This reverts commit79f82cf10e
. * Revert "Port rest of os ops to JSON (#2802)" This reverts commit5b2baa5c99
.
This commit is contained in:
parent
bdc0a13261
commit
2235dd795d
45 changed files with 1968 additions and 1045 deletions
|
@ -1,9 +1,17 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import * as dispatch from "./dispatch";
|
||||
import { sendSync } from "./dispatch_json";
|
||||
import { sendSync, msg, flatbuffers } from "./dispatch_flatbuffers";
|
||||
import { assert } from "./util";
|
||||
|
||||
// TODO(bartlomieju): move to `repl.ts`?
|
||||
export function formatError(errString: string): string {
|
||||
const res = sendSync(dispatch.OP_FORMAT_ERROR, { error: errString });
|
||||
return res.error;
|
||||
const builder = flatbuffers.createBuilder();
|
||||
const errString_ = builder.createString(errString);
|
||||
const offset = msg.FormatError.createFormatError(builder, errString_);
|
||||
const baseRes = sendSync(builder, msg.Any.FormatError, offset);
|
||||
assert(baseRes != null);
|
||||
assert(msg.Any.FormatErrorRes === baseRes!.innerType());
|
||||
const formatErrorResMsg = new msg.FormatErrorRes();
|
||||
assert(baseRes!.inner(formatErrorResMsg) != null);
|
||||
const formattedError = formatErrorResMsg.error();
|
||||
assert(formatError != null);
|
||||
return formattedError!;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue