log(db): Add db failure cause log message#4749
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview A new Reviewed by Cursor Bugbot for commit 81aa8d0. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds structured driver-error logging when workflow execution fails. Drizzle wraps the raw pg error as
Confidence Score: 5/5Safe to merge — the change is purely additive observability work confined to the catch block of the workflow executor; the error path behaviour is unchanged if describeErrorCause returns nothing. The walk is correctly bounded, the depth-1 fallback is only kept when no code-carrying error is found deeper in the chain, filterUndefined removes irrelevant undefined fields, and the try/catch ensures no secondary throw can occur. The guarded spread means the log call signature is identical to the original when no cause is found. All previously raised review concerns have been addressed in this commit. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[catch error: unknown] --> B[describeErrorCause error]
B --> C{current instanceof Error?}
C -- no --> D[return undefined]
C -- yes --> E{candidate.code !== undefined?}
E -- yes --> F[driver = candidate, break]
E -- no --> G{depth === 1?}
G -- yes --> H[driver = candidate fallback]
G -- no --> I[advance: current = candidate.cause]
H --> I
I --> J{depth < 10?}
J -- yes --> C
J -- no --> K{driver set?}
F --> K
K -- no --> D
K -- yes --> L[filterUndefined name/message/code/severity/detail/routine/errno/syscall]
L --> M[return Record]
M --> N{errorCause truthy?}
N -- no --> O[logger.error msg, error]
N -- yes --> P[logger.error msg, error, cause: errorCause]
P --> Q[Structured JSON entry with cause block]
Reviews (2): Last reviewed commit: "log(db): Add db failure cause log messag..." | Re-trigger Greptile |
ae81d04 to
81aa8d0
Compare
|
@greptile review |
Summary
cause(code, severity, detail, routine, errno, syscall) when workflow execution failserror.cause, which the logger's Error serializer dropped — leaving only an opaqueFailed query: ...message with no pg error codecausechain (depth-bounded to 10) and surface the first error carrying acode; this distinguishes a connection drop (08006), rejected connection (53300), and statement timeout (57014)causefield, never a masked failureType of Change
Testing
Tested manually;
bun run lintclean,bun run check:api-validation:strictpassed,tsc --noEmitclean. Motivated by intermittentschedule-executionfailures where the workspace/personal env reads in preprocessing fail with an opaque "Failed query" and no driver error code.Checklist