From 01e65bd9cfeaf8779fa65476c232cff1c4812832 Mon Sep 17 00:00:00 2001 From: Paula Stachova Date: Thu, 23 Jan 2025 22:22:31 +0100 Subject: [PATCH] Update src/schema-convertors/internalToMongoDB.ts Co-authored-by: Anna Henningsen --- src/schema-convertors/internalToMongoDB.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema-convertors/internalToMongoDB.ts b/src/schema-convertors/internalToMongoDB.ts index 85b2b5e..56958c7 100644 --- a/src/schema-convertors/internalToMongoDB.ts +++ b/src/schema-convertors/internalToMongoDB.ts @@ -56,7 +56,7 @@ function parseType(type: SchemaType, signal?: AbortSignal): MongoDBJSONSchema { } function parseTypes(types: SchemaType[], signal?: AbortSignal): MongoDBJSONSchema { - if (signal?.aborted) throw new Error('Operation aborted'); + if (signal?.aborted) throw signal.reason ?? new Error('Operation aborted'); const definedTypes = types.filter(type => type.bsonType.toLowerCase() !== 'undefined'); const isSingleType = definedTypes.length === 1; if (isSingleType) {