Skip to content

Commit 8f49d0d

Browse files
committed
fix: "Explore" (using --default-profile)
1 parent b32d559 commit 8f49d0d

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

crates/rostra-client/src/task/request_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ impl RequestHandler {
113113
match err {
114114
// normal, mostly ignore
115115
IncomingConnectionError::Connection { source: _, .. } => {
116-
trace!(target: LOG_TARGET, err=%err.fmt_compact(), %peer_addr, "Client disconnected");
116+
trace!(target: LOG_TARGET, err = %err.fmt_compact(), %peer_addr, "Client disconnected");
117117
}
118118
_ => {
119-
debug!(target: LOG_TARGET, err=%err.fmt_compact(), %peer_addr, "Error handling incoming connection");
119+
debug!(target: LOG_TARGET, err = %err.fmt_compact(), %peer_addr, "Error handling incoming connection");
120120
}
121121
}
122122
}

crates/rostra-web-ui/src/error.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rostra_client_db::DbError;
99
use rostra_util_error::{BoxedError, FmtCompact as _};
1010
use serde::Serialize;
1111
use snafu::Snafu;
12-
use tracing::info;
12+
use tracing::{debug, warn};
1313

1414
use super::routes::AppJson;
1515
use crate::{LOG_TARGET, UiStateClientError};
@@ -78,6 +78,7 @@ pub enum RequestError {
7878
#[snafu(visibility(pub(crate)))]
7979
Other { source: BoxedError },
8080
#[snafu(visibility(pub(crate)))]
81+
#[snafu(display("InternalServerError: {msg}"))]
8182
InternalServerError { msg: &'static str },
8283
#[snafu(visibility(pub(crate)))]
8384
LoginRequired { redirect: Option<String> },
@@ -92,10 +93,9 @@ pub type RequestResult<T> = std::result::Result<T, RequestError>;
9293

9394
impl IntoResponse for RequestError {
9495
fn into_response(self) -> Response {
95-
info!(
96+
debug!(
9697
target: LOG_TARGET,
97-
98-
err=%self.fmt_compact(),
98+
err = %self.fmt_compact(),
9999
"Request Error"
100100
);
101101

@@ -118,10 +118,17 @@ impl IntoResponse for RequestError {
118118
};
119119
return Redirect::to(&url).into_response();
120120
}
121-
_ => (
122-
StatusCode::INTERNAL_SERVER_ERROR,
123-
"Internal Service Error".to_owned(),
124-
),
121+
err => {
122+
warn!(
123+
target: LOG_TARGET,
124+
err = %err.fmt_compact(),
125+
"Unexpected Request Error"
126+
);
127+
(
128+
StatusCode::INTERNAL_SERVER_ERROR,
129+
"Internal Service Error".to_owned(),
130+
)
131+
}
125132
}
126133
}
127134
};

crates/rostra-web-ui/src/routes/unlock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ pub async fn post_unlock(
117117
}
118118
};
119119

120-
// 2. Insert session data into store (this creates/updates the session)
120+
// 2. Insert session data and save to store
121121
session
122122
.insert(SESSION_KEY, &UserSessionData::new(rostra_id))
123123
.await
124124
.boxed()
125125
.context(OtherSnafu)?;
126+
session.save().await.boxed().context(OtherSnafu)?;
126127

127-
// 3. Get session ID (now available after insert) and store secret
128-
// The session ID is available after the session has been modified.
128+
// 3. Get session ID (now available after save) and store secret
129129
if let Some(session_token) = SessionToken::from_session(&session) {
130130
state.set_session_secret(session_token, secret_key_opt);
131131

crates/rostra-web-ui/src/routes/unlock/session.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,25 @@ impl FromRequestParts<Arc<UiState>> for UserSession {
121121
.build()
122122
})?;
123123

124-
// Insert session data first
124+
// Insert session data and save to store
125125
let data = UserSessionData::new(default_id);
126126
session.insert(SESSION_KEY, &data).await.map_err(|_| {
127127
InternalServerSnafu {
128128
msg: "failed to insert session",
129129
}
130130
.build()
131131
})?;
132+
session.save().await.map_err(|_| {
133+
InternalServerSnafu {
134+
msg: "failed to save session",
135+
}
136+
.build()
137+
})?;
132138

133-
// Now get the session token (available after insert)
139+
// Now get the session token (available after save)
134140
let session_token = SessionToken::from_session(&session).ok_or_else(|| {
135141
InternalServerSnafu {
136-
msg: "session has no ID after insert",
142+
msg: "session has no ID after save",
137143
}
138144
.build()
139145
})?;

0 commit comments

Comments
 (0)