summaryrefslogtreecommitdiff
path: root/js/format_error.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-08-24 15:02:42 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-08-24 06:02:42 -0700
commit79f82cf10ed1dbf91346994250d7311a4d74377a (patch)
treeb00755d666198b9c66264a3c240f849096951e2f /js/format_error.ts
parent5b2baa5c990fbeae747e952c5dcd7a5369e950b1 (diff)
port ops to JSON: compiler, errors, fetch, files (#2804)
Diffstat (limited to 'js/format_error.ts')
-rw-r--r--js/format_error.ts18
1 files changed, 5 insertions, 13 deletions
diff --git a/js/format_error.ts b/js/format_error.ts
index 6670b05e2..dde0f6a58 100644
--- a/js/format_error.ts
+++ b/js/format_error.ts
@@ -1,17 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, msg, flatbuffers } from "./dispatch_flatbuffers";
-import { assert } from "./util";
+import * as dispatch from "./dispatch";
+import { sendSync } from "./dispatch_json";
+// TODO(bartlomieju): move to `repl.ts`?
export function formatError(errString: string): string {
- 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!;
+ const res = sendSync(dispatch.OP_FORMAT_ERROR, { error: errString });
+ return res.error;
}