From 9f6eaffec66396cd891e39eca93a41e71cf8d321 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Sun, 29 Sep 2024 07:35:59 +0100 Subject: [PATCH] remove wrapping --- lib/types.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/types.js b/lib/types.js index 5521296c..cba76fd2 100644 --- a/lib/types.js +++ b/lib/types.js @@ -202,14 +202,10 @@ class Type { if (!UnionType) { if (typeof opts.wrapUnions === 'function') { // we have a projection function - try { - projectionFn = opts.wrapUnions(types); - UnionType = typeof projectionFn !== 'undefined' - ? UnwrappedUnionType - : WrappedUnionType; - } catch(e) { - throw new Error(`Error generating projection function: ${e}`); - } + projectionFn = opts.wrapUnions(types); + UnionType = typeof projectionFn !== 'undefined' + ? UnwrappedUnionType + : WrappedUnionType; } else { UnionType = isAmbiguous(types) ? WrappedUnionType : UnwrappedUnionType; } @@ -1319,11 +1315,7 @@ class UnwrappedUnionType extends UnionType { super(schema, opts); if (!_projectionFn && opts && typeof opts.wrapUnions === 'function') { - try { - _projectionFn = opts.wrapUnions(this.types); - } catch(e) { - throw new Error(`Error generating projection function: ${e}`); - } + _projectionFn = opts.wrapUnions(this.types); } this._getIndex = _projectionFn ? generateProjectionIndexer(_projectionFn)