Skip to content

Commit 210af6b

Browse files
committed
chore: unwrap
1 parent ab703be commit 210af6b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

rust/cubesql/cubesql/src/compile/router.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ impl QueryRouter {
456456
.session_manager
457457
.server
458458
.auth
459-
// TODO do we want to send actual password here?
460459
.authenticate(sql_auth_request, Some(to_user.clone()), None)
461460
.await
462461
.map_err(|e| {
@@ -466,8 +465,12 @@ impl QueryRouter {
466465
.set_auth_context(Some(authenticate_response.context));
467466
} else {
468467
return Err(CompilationError::user(format!(
469-
"user '{:?}' is not allowed to switch to '{}'",
470-
auth_context.user(),
468+
"user '{}' is not allowed to switch to '{}'",
469+
auth_context
470+
.user()
471+
.as_ref()
472+
.map(|v| v.as_str())
473+
.unwrap_or("not specified"),
471474
to_user
472475
)));
473476
}

rust/cubesql/cubesql/src/compile/snapshots/cubesql__compile__tests__set_bad_user.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: cubesql/src/compile/mod.rs
33
expression: "execute_queries_with_flags(vec![\"SET user = 'bad_user'\".to_string()],\nDatabaseProtocol::PostgreSQL).await.err().unwrap().to_string()"
44
---
5-
Error during planning: SQLCompilationError: User: user 'None' is not allowed to switch to 'bad_user'
5+
Error during planning: SQLCompilationError: User: user 'not specified' is not allowed to switch to 'bad_user'

0 commit comments

Comments
 (0)