@@ -5,7 +5,7 @@ import * as constants from '../constants';
55import type { DBRefLike } from '../db_ref' ;
66import type { Decimal128 } from '../decimal128' ;
77import type { Double } from '../double' ;
8- import { BSONError } from '../error' ;
8+ import { BSONError , BSONVersionError } from '../error' ;
99import type { Int32 } from '../int_32' ;
1010import { Long } from '../long' ;
1111import type { MinKey } from '../min_key' ;
@@ -710,7 +710,7 @@ export function serializeInto(
710710 typeof value === 'object' &&
711711 value [ Symbol . for ( '@@mdb.bson.version' ) ] !== constants . BSON_MAJOR_VERSION
712712 ) {
713- throw new BSONError ( 'Unsupported BSON version, bson types must be from bson 5.0 or later' ) ;
713+ throw new BSONVersionError ( ) ;
714714 } else if ( value . _bsontype === 'ObjectId' ) {
715715 index = serializeObjectId ( buffer , key , value , index ) ;
716716 } else if ( value . _bsontype === 'Decimal128' ) {
@@ -820,7 +820,7 @@ export function serializeInto(
820820 typeof value === 'object' &&
821821 value [ Symbol . for ( '@@mdb.bson.version' ) ] !== constants . BSON_MAJOR_VERSION
822822 ) {
823- throw new BSONError ( 'Unsupported BSON version, bson types must be from bson 5.0 or later' ) ;
823+ throw new BSONVersionError ( ) ;
824824 } else if ( value . _bsontype === 'ObjectId' ) {
825825 index = serializeObjectId ( buffer , key , value , index ) ;
826826 } else if ( type === 'object' && value . _bsontype === 'Decimal128' ) {
@@ -930,7 +930,7 @@ export function serializeInto(
930930 typeof value === 'object' &&
931931 value [ Symbol . for ( '@@mdb.bson.version' ) ] !== constants . BSON_MAJOR_VERSION
932932 ) {
933- throw new BSONError ( 'Unsupported BSON version, bson types must be from bson 5.0 or later' ) ;
933+ throw new BSONVersionError ( ) ;
934934 } else if ( value . _bsontype === 'ObjectId' ) {
935935 index = serializeObjectId ( buffer , key , value , index ) ;
936936 } else if ( type === 'object' && value . _bsontype === 'Decimal128' ) {
0 commit comments