summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-26 17:54:22 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-07-29 00:22:39 -0400
commit4d386e9e1c79d557cae6af58e6df85eb470c1e0c (patch)
tree2a5bda6620b2d68ea5f06e4c49c9b9a3ad4c76f2 /js
parent1f093c12f84d269cb68370262d68ff6d515aef2e (diff)
Implement CodeCache
Diffstat (limited to 'js')
-rw-r--r--js/os.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/js/os.ts b/js/os.ts
index 0dc9aeadc..3f71c0e64 100644
--- a/js/os.ts
+++ b/js/os.ts
@@ -71,7 +71,13 @@ export function codeCache(
fbs.Base.addMsgType(builder, fbs.Any.CodeCache);
builder.finish(fbs.Base.endBase(builder));
const resBuf = deno.send(builder.asUint8Array());
- assert(resBuf == null);
+ // Expect null or error.
+ if (resBuf != null) {
+ const bb = new flatbuffers.ByteBuffer(new Uint8Array(resBuf));
+ const baseRes = fbs.Base.getRootAsBase(bb);
+ assert(fbs.Any.NONE === baseRes.msgType());
+ throw Error(baseRes.error());
+ }
}
export function readFileSync(filename: string): Uint8Array {