deep-foundation / deep-foundation/deeplinks

Preserve stacktraces when using DeepClient methods

Open
#221 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
13
Forks
8
PR merge metrics
No merged PRs in 30d

Description

When I run DeepClient methods it removes stacktraces and I see errors like this:
```
391 | catch (e) {
392 | const sqlError = (_d = (_c = (_b = (_a = e === null || e === void 0 ? void 0 : e.graphQLErrors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.extensions) === null || _c === void 0 ? void 0 : _c.internal) === null || _d === void 0 ? void 0 : _d.error;
393 | if (sqlError === null || sqlError === void 0 ? void 0 : sqlError.message)
394 | e.message = sqlError.message;
395 | if (!this._silent(options))
396 | throw new Error(`DeepClient Insert Error: ${e.message}`, { cause: e });
^
error: DeepClient Insert Error: Was there a typo in the url or port?
at /home/freephoenix888/Programming/object-to-links-async-converter/node_modules/@deep-foundation/deeplinks/imports/client.js:396:26
at rejected (/home/freephoenix888/Programming/object-to-links-async-converter/node_modules/@deep-foundation/deeplinks/imports/client.js:5:46)
at processTicksAndRejections (:1:2602)
```

Possible Reason: we create a new error instead of modifying the existing one or we should create a new message and merge its stacktrace with the old one but modifying the existing one is more easier

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting imports/client.js around line 396, where DeepClient wraps and rethrows the insert error. Trace how the original error reaches this catch block and check whether its stack is retained. Done means DeepClient errors preserve the relevant original stacktrace while still exposing the DeepClient error context.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.