Skip to content

[All-kit]: keep the real error when pull fails for non-driver reasons - #6502

Open
bunnysayzz wants to merge 1 commit into
drizzle-team:betafrom
bunnysayzz:fix/pull-surface-non-driver-errors-6501
Open

bunnysayzz wants to merge 1 commit into
drizzle-team:betafrom
bunnysayzz:fix/pull-surface-non-driver-errors-6501

Conversation

@bunnysayzz

Copy link
Copy Markdown

Root cause

runPull in drizzle-kit/src/cli/schema.ts wraps each dialect branch in a try/catch that rethrows every failure as DatabaseDriverCliError. That error class exists to redact QueryError, which carries sql/params/credentials into the envelope (connect returns lazy proxies, so failures surface as QueryError during introspection).

The problem: the catch did not distinguish. A TypeError or an EISDIR thrown later in the span, e.g. by the schema writer, got the same redaction, so the real message never reached the user. Only the "Failed to connect to or introspect..." text and the driver package list survived.

What changed

In all seven dialect branches, the catch now rethrows anything that is not a QueryError as-is (if (isTypedCliError(e) || !(e instanceof QueryError)) throw e;), so non-driver failures take the generic handler path and their real message is printed. QueryError still gets the redacted DatabaseDriverCliError, keeping the sql/params/credentials redaction. Same change in the --init migrate span, which shares the identical shape and redaction comment.

Tests

  • Transpiled the touched files with tsc: 0 syntax errors.
  • Simulated the catch logic: QueryError still becomes the redacted driver error, an EISDIR keeps its original message, typed CLI errors pass through unchanged.
  • Could not run the kit vitest suite on this machine (no pnpm workspace install); happy to iterate if CI flags anything.

Fixes #6501

runPull wraps each dialect branch in a catch that rethrows every failure as
DatabaseDriverCliError, which exists to redact QueryError (it carries
sql/params/credentials into the envelope). Any other failure from later in
the span (a TypeError, an EISDIR from the schema writer, ...) got the same
redaction, so the real cause never reached the user. Only QueryError needs
the redacted re-throw now; everything else is re-thrown as-is and takes the
generic handler path. Same change in the --init migrate span, which shares
the identical shape and redaction comment.

Fixes drizzle-team#6501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant