fix: server function custom errors set status codes (#4782)

* fix: handling status codes from errors

* add demo

* clippy + check

* fix clippy again
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-10-13 16:02:33 -07:00
1 parent fc069f0faf
commit 8f6e7dc1f2
9 files changed
+356 -44

No files matched your search

+6 -9
View File
@@ -258,15 +258,12 @@ impl SsrRendererPool {
// we need to eventually be able to downcast that and get the status code from it
if let Some(ServerFnError::ServerError { message, code, .. }) = error.downcast_ref()
{
if let Some(code) = code {
status_code = Some(
(*code)
.try_into()
.unwrap_or(StatusCode::INTERNAL_SERVER_ERROR),
);
} else {
status_code = Some(StatusCode::INTERNAL_SERVER_ERROR);
}
status_code = Some(
(*code)
.try_into()
.unwrap_or(StatusCode::INTERNAL_SERVER_ERROR),
);
out_message = Some(message.clone());
}