77 makeContext ,
88 propagateToContext ,
99 propagateToRequest ,
10- unserializeError ,
10+ deserializeError ,
1111} from './compatibility-utils' ;
1212import { MiddlewareContext } from './MiddlewareContext' ;
1313import { stringify } from './utils' ;
@@ -348,7 +348,7 @@ describe('compatibility-utils', () => {
348348 } ) ;
349349 } ) ;
350350
351- describe ( 'unserializeError ' , ( ) => {
351+ describe ( 'deserializeError ' , ( ) => {
352352 // Requires some special handling due to the possible existence or
353353 // non-existence of Error.isError
354354 describe ( 'Error.isError' , ( ) => {
@@ -382,22 +382,22 @@ describe('compatibility-utils', () => {
382382 isError . mockReturnValueOnce ( true ) ;
383383 const originalError = new Error ( 'test error' ) ;
384384
385- const result = unserializeError ( originalError ) ;
385+ const result = deserializeError ( originalError ) ;
386386 expect ( result ) . toBe ( originalError ) ;
387387 } ) ;
388388
389389 it ( 'returns the thrown value when it is instanceof Error' , ( ) => {
390390 isError . mockReturnValueOnce ( false ) ;
391391 const originalError = new Error ( 'test error' ) ;
392392
393- const result = unserializeError ( originalError ) ;
393+ const result = deserializeError ( originalError ) ;
394394 expect ( result ) . toBe ( originalError ) ;
395395 } ) ;
396396 } ) ;
397397
398398 it ( 'creates a new Error when thrown value is a string' , ( ) => {
399399 const errorMessage = 'test error message' ;
400- const result = unserializeError ( errorMessage ) ;
400+ const result = deserializeError ( errorMessage ) ;
401401
402402 expect ( result ) . toBeInstanceOf ( Error ) ;
403403 expect ( result . message ) . toBe ( errorMessage ) ;
@@ -406,7 +406,7 @@ describe('compatibility-utils', () => {
406406 it . each ( [ 42 , true , false , null , undefined , Symbol ( 'test' ) ] ) (
407407 'creates a new Error with stringified message for non-object values' ,
408408 ( value ) => {
409- const result = unserializeError ( value ) ;
409+ const result = deserializeError ( value ) ;
410410
411411 expect ( result ) . toBeInstanceOf ( Error ) ;
412412 expect ( result . message ) . toBe ( `Unknown error: ${ stringify ( value ) } ` ) ;
@@ -421,7 +421,7 @@ describe('compatibility-utils', () => {
421421 data : { foo : 'bar' } ,
422422 } ;
423423
424- const result = unserializeError ( thrownValue ) ;
424+ const result = deserializeError ( thrownValue ) ;
425425
426426 expect ( result ) . toBeInstanceOf ( JsonRpcError ) ;
427427 expect ( result ) . toMatchObject ( {
@@ -439,7 +439,7 @@ describe('compatibility-utils', () => {
439439 data : { foo : 'bar' } ,
440440 } ;
441441
442- const result = unserializeError ( thrownValue ) ;
442+ const result = deserializeError ( thrownValue ) ;
443443
444444 expect ( result ) . toBeInstanceOf ( Error ) ;
445445 expect ( result ) . not . toBeInstanceOf ( JsonRpcError ) ;
@@ -455,7 +455,7 @@ describe('compatibility-utils', () => {
455455 message : 'test error message' ,
456456 } ;
457457
458- const result = unserializeError ( thrownValue ) ;
458+ const result = deserializeError ( thrownValue ) ;
459459
460460 expect ( result ) . toBeInstanceOf ( Error ) ;
461461 expect ( result ) . not . toBeInstanceOf ( JsonRpcError ) ;
@@ -469,7 +469,7 @@ describe('compatibility-utils', () => {
469469 stack : stackTrace ,
470470 } ;
471471
472- const result = unserializeError ( thrownValue ) ;
472+ const result = deserializeError ( thrownValue ) ;
473473
474474 expect ( result ) . toBeInstanceOf ( Error ) ;
475475 expect ( result . stack ) . toBe ( stackTrace ) ;
@@ -485,7 +485,7 @@ describe('compatibility-utils', () => {
485485 data,
486486 } ;
487487
488- const result = unserializeError ( thrownValue ) as JsonRpcError < Json > ;
488+ const result = deserializeError ( thrownValue ) as JsonRpcError < Json > ;
489489
490490 expect ( result . cause ) . toBe ( cause ) ;
491491 expect ( result . data ) . toStrictEqual ( {
@@ -499,7 +499,7 @@ describe('compatibility-utils', () => {
499499 code : 1234 ,
500500 } ;
501501
502- const result = unserializeError ( thrownValue ) ;
502+ const result = deserializeError ( thrownValue ) ;
503503
504504 expect ( result . message ) . toBe ( 'Unknown error' ) ;
505505 } ) ;
@@ -510,7 +510,7 @@ describe('compatibility-utils', () => {
510510 message : 42 ,
511511 } ;
512512
513- const result = unserializeError ( thrownValue ) ;
513+ const result = deserializeError ( thrownValue ) ;
514514
515515 expect ( result . message ) . toBe ( 'Unknown error' ) ;
516516 } ) ;
@@ -521,7 +521,7 @@ describe('compatibility-utils', () => {
521521 message : 42 ,
522522 } ;
523523
524- const result = unserializeError ( thrownValue ) ;
524+ const result = deserializeError ( thrownValue ) ;
525525
526526 expect ( result . message ) . toBe ( 'Internal JSON-RPC error.' ) ;
527527 } ) ;
0 commit comments