Skip to content

Commit

Permalink
panic handling, per Joonas' comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hlinnaka committed May 23, 2023
1 parent 3b27ee6 commit f7b5731
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pageserver/src/http/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,10 +1204,18 @@ where
match result {
Ok(result) => result,
Err(e) => {
error!("HTTP request handler task panicked: {e:?}");
Err(ApiError::InternalServerError(anyhow!(
"HTTP request handler task panicked"
)))
// The handler task panicked. We have a global panic handler that logs the
// panic with its backtrace, so no need to log that here. Only log a brief
// message to make it clear that we returned the error to the client.
error!("HTTP request handler task panicked: {e:#}");

// Don't return an Error here, because then fallback error handler that was
// installed in make_router() will print the error. Instead, construct the
// HTTP error response and return that.
Ok(
ApiError::InternalServerError(anyhow!("HTTP request handler task panicked"))
.into_response(),
)
}
}
}
Expand Down

0 comments on commit f7b5731

Please sign in to comment.