Skip to content

Commit

Permalink
fix(captp): relax it.throw signature
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jul 19, 2021
1 parent 5a370a8 commit 6fc842c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/captp/src/atomics.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const makeAtomicsTrapGuest = transferBuffer => {
// Start by sending the trap call to the host.
const it = startTrap();

/** @type {Uint8Array} */
/** @type {Uint8Array | undefined} */
let encoded;
let i = 0;
let done = false;
Expand All @@ -138,7 +138,7 @@ export const makeAtomicsTrapGuest = transferBuffer => {
// Accumulate the encoded buffer.
const remaining = Number(lenbuf[0]);
const datalen = Math.min(remaining, databuf.byteLength);
if (i === 0) {
if (!encoded) {
if (done) {
// Special case: we are done on first try, so we don't need to copy
// anything.
Expand All @@ -160,7 +160,7 @@ export const makeAtomicsTrapGuest = transferBuffer => {
// TODO: It would be nice to use an error type, but captp is just too
// noisy with spurious "Temporary logging of sent error" messages.
// it.throw(assert.error(X`Trap host has not finished`));
it.throw(undefined);
it.throw(null);

// eslint-disable-next-line no-bitwise
const isReject = !!(statusbuf[0] & STATUS_FLAG_REJECT);
Expand Down
2 changes: 1 addition & 1 deletion packages/captp/src/captp.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export const makeCapTP = (
return await ait[method](...args);
} catch (e) {
cleanup();
if (e === undefined) {
if (!e) {
assert.fail(
X`trapGuest expected trapHost AsyncIterator(${questionID}) to be done, but it wasn't`,
);
Expand Down

0 comments on commit 6fc842c

Please sign in to comment.