Repository navigation
[All-kit]: keep the real error when pull fails for non-driver reasons - #6502
Open
bunnysayzz wants to merge 1 commit into
Open
bunnysayzz wants to merge 1 commit into
bunnysayzz wants to merge 1 commit into
Conversation
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
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
runPullindrizzle-kit/src/cli/schema.tswraps each dialect branch in a try/catch that rethrows every failure asDatabaseDriverCliError. That error class exists to redactQueryError, 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
TypeErroror anEISDIRthrown 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
QueryErroras-is (if (isTypedCliError(e) || !(e instanceof QueryError)) throw e;), so non-driver failures take the generic handler path and their real message is printed.QueryErrorstill gets the redactedDatabaseDriverCliError, keeping the sql/params/credentials redaction. Same change in the--initmigrate span, which shares the identical shape and redaction comment.Tests
Fixes #6501