Skip to content

Commit

Permalink
database-utils: Provide more detail on parse failure.
Browse files Browse the repository at this point in the history
If the upstream db url fails to parse due to special characters in the
password, it can result in confusing error messages like "Invalid port
number" because the parser doesn't fail until a later element in the
uri.

This commit adds more detail to the error message recommending that the
user percent-encode special characters as well as point to our
public documentation (since there may be other issues that cause the url
to fail parsing, and it's not easy to provide detailed guidance for
every possible case).

Release-Note-Core: Provided a better error message and guidance for
  passwords that include special characters, which must be
  percent-encoded.

Change-Id: I86a8f0ef3cc57eb9b1a9a0d956826c407002bc47
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5837
Reviewed-by: Dan Wilbanks <[email protected]>
Tested-by: Buildkite CI
  • Loading branch information
lukoktonos committed Aug 21, 2023
1 parent c92db77 commit e166f17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions database-utils/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ pub enum DatabaseURLParseError {
#[error("Invalid database URL format; ReadySet requires that Postgres database URLs contain a database name")]
MissingPostgresDbName,

#[error(transparent)]
#[error("Invalid database URL format: {0}; Make sure any special characters are percent-encoded. See https://docs.readyset.io/reference/cli/readyset#--upstream-db-url for more details.")]
PostgreSQL(#[from] pgsql::Error),

#[error(transparent)]
#[error("Invalid database URL format: {0}; Make sure any special characters are percent-encoded. See https://docs.readyset.io/reference/cli/readyset#--upstream-db-url for more details.")]
MySQL(#[from] mysql::UrlError),
}

Expand Down

0 comments on commit e166f17

Please sign in to comment.