fixes
This commit is contained in:
2
client
2
client
Submodule client updated: 9d6b35a787...9b57d475cc
2
server
2
server
Submodule server updated: f1b2381563...59dee75ae6
@@ -489,7 +489,7 @@ fn reject(headers: &HeaderMap, message: String) -> Response {
|
|||||||
/// pattern a value does not satisfy — is the user's to fix and answers 422;
|
/// pattern a value does not satisfy — is the user's to fix and answers 422;
|
||||||
/// only an actually unreachable backend answers 502.
|
/// only an actually unreachable backend answers 502.
|
||||||
fn grpc_error(headers: &HeaderMap, error: &tonic::Status) -> Response {
|
fn grpc_error(headers: &HeaderMap, error: &tonic::Status) -> Response {
|
||||||
crate::ui::FormError::from_status(error)
|
crate::ui::FormError::from_status_with_message(error, format!("{error:?}"))
|
||||||
.into_response(Locale::from_headers(headers), ui::render_error)
|
.into_response(Locale::from_headers(headers), ui::render_error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,13 +509,14 @@ fn import_error(
|
|||||||
return failure.into_response(locale, ui::render_error);
|
return failure.into_response(locale, ui::render_error);
|
||||||
}
|
}
|
||||||
let status = failure.status_code();
|
let status = failure.status_code();
|
||||||
|
let backend_error = format!("{error:?}");
|
||||||
let message = ui::render_import_failure(
|
let message = ui::render_import_failure(
|
||||||
locale,
|
locale,
|
||||||
inserted_before_chunk + inserted_in_chunk,
|
inserted_before_chunk + inserted_in_chunk,
|
||||||
prepared_rows,
|
prepared_rows,
|
||||||
// One header row precedes the data, and CSV rows are one-based.
|
// One header row precedes the data, and CSV rows are one-based.
|
||||||
chunk_start + failed_row_index + 2,
|
chunk_start + failed_row_index + 2,
|
||||||
failure.message(),
|
&backend_error,
|
||||||
);
|
);
|
||||||
(status, Html(message)).into_response()
|
(status, Html(message)).into_response()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,13 @@ impl FormError {
|
|||||||
/// on some pages and a rejected submission as an unreachable backend on
|
/// on some pages and a rejected submission as an unreachable backend on
|
||||||
/// others.
|
/// others.
|
||||||
pub(crate) fn from_status(status: &tonic::Status) -> Self {
|
pub(crate) fn from_status(status: &tonic::Status) -> Self {
|
||||||
let message = status.message().to_string();
|
Self::from_status_with_message(status, status.message().to_string())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn from_status_with_message(
|
||||||
|
status: &tonic::Status,
|
||||||
|
message: String,
|
||||||
|
) -> Self {
|
||||||
match status.code() {
|
match status.code() {
|
||||||
tonic::Code::Unauthenticated => Self::Unauthenticated,
|
tonic::Code::Unauthenticated => Self::Unauthenticated,
|
||||||
tonic::Code::PermissionDenied => Self::Forbidden(message),
|
tonic::Code::PermissionDenied => Self::Forbidden(message),
|
||||||
|
|||||||
Reference in New Issue
Block a user