fix(marshal): Check if input is an error before checking if it is remotable
Fixes
MODIFY
packages/marshal/src/passStyleOf.js
packages/marshal/src/passStyleOf.js
@@ -12,8 +12,8 @@ import {
import { CopyArrayHelper } from './helpers/copyArray.js';
import { CopyRecordHelper } from './helpers/copyRecord.js';
import { TaggedHelper } from './helpers/tagged.js';
-import { RemotableHelper } from './helpers/remotable.js';
import { ErrorHelper } from './helpers/error.js';
+import { RemotableHelper } from './helpers/remotable.js';
import { assertPassableSymbol } from './helpers/symbol.js';
import { assertSafePromise } from './helpers/safe-promise.js';
@@ -42,8 +42,8 @@ const makeHelperTable = passStyleHelpers => {
copyArray: undefined,
copyRecord: undefined,
tagged: undefined,
- remotable: undefined,
error: undefined,
+ remotable: undefined,
};
for (const helper of passStyleHelpers) {
const { styleName } = helper;
@@ -203,8 +203,8 @@ export const passStyleOf = makePassStyleOf([
CopyArrayHelper,
CopyRecordHelper,
TaggedHelper,
- RemotableHelper,
ErrorHelper,
+ RemotableHelper,
]);
export const assertPassable = val => {

MODIFY
packages/marshal/test/test-passStyleOf.js
packages/marshal/test/test-passStyleOf.js
@@ -25,6 +25,12 @@ test('passStyleOf basic success cases', t => {
t.is(passStyleOf(harden({ then: 'non-function then ok' })), 'copyRecord');
t.is(passStyleOf(makeTagged('unknown', undefined)), 'tagged');
t.is(passStyleOf(harden(Error('ok'))), 'error');
+
+ const hairlessError = Error('hairless');
+ for (const k of ownKeys(hairlessError)) {
+ delete hairlessError[k];
+ }
+ t.is(passStyleOf(harden(hairlessError)), 'error');
});
test('some passStyleOf rejections', t => {

fix(marshal): Check if input is an error before checking if it is remotable (#1323)

Fixes #1318