-
Notifications
You must be signed in to change notification settings - Fork 40
[1.11.2] Add enhanced stack traces and a few more try-catch blocks #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds enriched stack trace capture and augmentation utilities, integrating them into the NodeBaseConnection to improve error diagnostics.
- Introduces
getCurrentStackTrace
andaddStackTrace
in the common error module - Wraps key error handlers in
NodeBaseConnection
to attach full call-site traces - Exports new utilities via the common package index
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/client-node/src/connection/node_base_connection.ts | Captures a baseline stack and wraps all error callbacks with augmented traces |
packages/client-common/src/index.ts | Re-exports getCurrentStackTrace and addStackTrace alongside parseError |
packages/client-common/src/error/index.ts | Updates error barrel to point to the new error.ts entrypoint |
packages/client-common/src/error/error.ts | Defines getCurrentStackTrace , addStackTrace , and extends ClickHouseError |
Comments suppressed due to low confidence (2)
packages/client-common/src/error/error.ts:37
- The new utilities
getCurrentStackTrace
andaddStackTrace
currently lack dedicated unit tests; adding tests would ensure these functions behave correctly across scenarios.
export function getCurrentStackTrace(): string {
packages/client-common/src/error/error.ts:53
- [nitpick]
addStackTrace
is a public API but lacks JSDoc explaining its parameters, return value, and side effects; consider adding a doc comment for clarity.
export function addStackTrace<E extends Error>(err: E, stackTrace: string): E {
socket.setTimeout(this.params.request_timeout, onTimeout) | ||
} | ||
|
||
function onTimeout(): void { | ||
const err = addStackTrace(new Error('Timeout error.'), stackTrace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error
constructor seems to have { cause }
for changing the error messages https://nodejs.org/docs/latest-v18.x/api/errors.html#errorcapturestacktracetargetobject-constructoropt
Well, fair enough, let's add more unit tests. |
|
Summary
Added a new configuration option:
capture_enhanced_stack_trace
; see the JS doc in the Node.js client package. Note that it is disabled by default due to a possible performance impact. For example:instead of previous:
Should be released as a patch version helping to debug #410