Skip to content

Commit 4799615

Browse files
committed
fix(cubesql): Propagate errors from SqlAuthService to the user
1 parent 91d57de commit 4799615

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

rust/cubesql/cubesql/src/sql/postgres/pg_auth_service.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,14 @@ impl PostgresAuthService for PostgresAuthServiceDefaultImpl {
8787
)
8888
.await;
8989

90-
let auth_fail = || {
91-
AuthenticationStatus::Failed(format!(
92-
"password authentication failed for user \"{}\"",
93-
user
94-
))
95-
};
96-
97-
let Ok(authenticate_response) = authenticate_response else {
98-
return auth_fail();
90+
let authenticate_response = match authenticate_response {
91+
Ok(r) => r,
92+
Err(err) => {
93+
return AuthenticationStatus::Failed(format!(
94+
"password authentication failed for user \"{}\". \nError: {}",
95+
user, err.message,
96+
))
97+
}
9998
};
10099

101100
if !authenticate_response.skip_password_check {
@@ -104,7 +103,10 @@ impl PostgresAuthService for PostgresAuthServiceDefaultImpl {
104103
Some(password) => password == password_message.password,
105104
};
106105
if !is_password_correct {
107-
return auth_fail();
106+
return AuthenticationStatus::Failed(format!(
107+
"password authentication failed for user \"{}\"",
108+
user
109+
));
108110
}
109111
}
110112

0 commit comments

Comments
 (0)