From d050b491b10fe37b4461b37c56028a14c8674c95 Mon Sep 17 00:00:00 2001 From: Inteon <42113979+inteon@users.noreply.github.com> Date: Thu, 8 Apr 2021 18:04:02 +0200 Subject: fix(core): error handling in examples (#9867) --- runtime/js/12_io.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'runtime/js/12_io.js') diff --git a/runtime/js/12_io.js b/runtime/js/12_io.js index aa153e9fd..a6b6aeebd 100644 --- a/runtime/js/12_io.js +++ b/runtime/js/12_io.js @@ -82,9 +82,6 @@ } const nread = core.binOpSync("op_read_sync", rid, buffer); - if (nread < 0) { - throw new Error("read error"); - } return nread === 0 ? null : nread; } @@ -98,29 +95,16 @@ } const nread = await core.binOpAsync("op_read_async", rid, buffer); - if (nread < 0) { - throw new Error("read error"); - } return nread === 0 ? null : nread; } function writeSync(rid, data) { - const result = core.binOpSync("op_write_sync", rid, data); - if (result < 0) { - throw new Error("write error"); - } - - return result; + return core.binOpSync("op_write_sync", rid, data); } async function write(rid, data) { - const result = await core.binOpAsync("op_write_async", rid, data); - if (result < 0) { - throw new Error("write error"); - } - - return result; + return await core.binOpAsync("op_write_async", rid, data); } const READ_PER_ITER = 32 * 1024; -- cgit v1.2.3