@@ -227,25 +227,25 @@ export const makeEncodeToCapData = ({
227
227
) } ${ q ( 'slot' ) } : ${ encoded } `,
228
228
) ;
229
229
}
230
- case 'error ' : {
231
- const encoded = encodeErrorToCapData ( passable , encodeToCapDataRecur ) ;
232
- if ( qclassMatches ( encoded , 'error ' ) ) {
230
+ case 'promise ' : {
231
+ const encoded = encodePromiseToCapData ( passable , encodeToCapDataRecur ) ;
232
+ if ( qclassMatches ( encoded , 'slot ' ) ) {
233
233
return encoded ;
234
234
}
235
235
assert . fail (
236
- X `internal: Error encoding must be an object with ${ q ( QCLASS ) } ${ q (
237
- 'error ' ,
236
+ X `internal: Promise encoding must be an object with ${ q ( QCLASS ) } ${ q (
237
+ 'slot ' ,
238
238
) } : ${ encoded } `,
239
239
) ;
240
240
}
241
- case 'promise ' : {
242
- const encoded = encodePromiseToCapData ( passable , encodeToCapDataRecur ) ;
243
- if ( qclassMatches ( encoded , 'slot ' ) ) {
241
+ case 'error ' : {
242
+ const encoded = encodeErrorToCapData ( passable , encodeToCapDataRecur ) ;
243
+ if ( qclassMatches ( encoded , 'error ' ) ) {
244
244
return encoded ;
245
245
}
246
246
assert . fail (
247
- X `internal: Promise encoding must be an object with ${ q ( QCLASS ) } ${ q (
248
- 'slot ' ,
247
+ X `internal: Error encoding must be an object with ${ q ( QCLASS ) } ${ q (
248
+ 'error ' ,
249
249
) } : ${ encoded } `,
250
250
) ;
251
251
}
@@ -396,7 +396,6 @@ export const makeDecodeFromCapData = ({
396
396
const { name } = jsonEncoded ;
397
397
return passableSymbolForName ( name ) ;
398
398
}
399
-
400
399
case 'tagged' : {
401
400
// Using @ts -ignore rather than @ts-expect-error below because
402
401
// with @ts -expect-error I get a red underline in vscode, but
@@ -406,20 +405,6 @@ export const makeDecodeFromCapData = ({
406
405
const { tag, payload } = jsonEncoded ;
407
406
return makeTagged ( tag , decodeFromCapData ( payload ) ) ;
408
407
}
409
-
410
- case 'error' : {
411
- const decoded = decodeErrorFromCapData (
412
- jsonEncoded ,
413
- decodeFromCapData ,
414
- ) ;
415
- if ( passStyleOf ( decoded ) === 'error' ) {
416
- return decoded ;
417
- }
418
- assert . fail (
419
- X `internal: decodeErrorFromCapData option must return an error: ${ decoded } ` ,
420
- ) ;
421
- }
422
-
423
408
case 'slot' : {
424
409
// See note above about how the current encoding cannot reliably
425
410
// distinguish which we should call, so in the non-default case
@@ -436,7 +421,18 @@ export const makeDecodeFromCapData = ({
436
421
X `internal: decodeRemotableFromCapData option must return a remotable or promise: ${ decoded } ` ,
437
422
) ;
438
423
}
439
-
424
+ case 'error' : {
425
+ const decoded = decodeErrorFromCapData (
426
+ jsonEncoded ,
427
+ decodeFromCapData ,
428
+ ) ;
429
+ if ( passStyleOf ( decoded ) === 'error' ) {
430
+ return decoded ;
431
+ }
432
+ assert . fail (
433
+ X `internal: decodeErrorFromCapData option must return an error: ${ decoded } ` ,
434
+ ) ;
435
+ }
440
436
case 'hilbert' : {
441
437
// Using @ts -ignore rather than @ts-expect-error below because
442
438
// with @ts -expect-error I get a red underline in vscode, but
@@ -467,7 +463,6 @@ export const makeDecodeFromCapData = ({
467
463
}
468
464
return result ;
469
465
}
470
-
471
466
// @ts -expect-error This is the error case we're testing for
472
467
case 'ibid' : {
473
468
assert . fail (
0 commit comments