Report RPC errors
ci/woodpecker/push/ociImagePush Pipeline was successful Details

This commit is contained in:
Natty 2024-11-15 23:43:01 +01:00
parent 51375e2ded
commit ad3b0e1ffb
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 10 additions and 6 deletions

View File

@ -6,6 +6,7 @@ use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::any::Any; use std::any::Any;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt::Display;
use std::future::Future; use std::future::Future;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -55,7 +56,7 @@ pub struct RpcResult<T> {
data: T, data: T,
} }
impl<T: Serialize + Send + 'static, E: Serialize + Send + 'static> IntoRpcResponse impl<T: Serialize + Send + 'static, E: Serialize + Display + Send + 'static> IntoRpcResponse
for Result<T, E> for Result<T, E>
{ {
fn into_rpc_response(self) -> Option<RpcResponse> { fn into_rpc_response(self) -> Option<RpcResponse> {
@ -65,11 +66,14 @@ impl<T: Serialize + Send + 'static, E: Serialize + Send + 'static> IntoRpcRespon
data, data,
}) })
.into_rpc_response(), .into_rpc_response(),
Err(data) => RpcMessage(RpcResult { Err(data) => {
success: false, error!("{}", data);
data, RpcMessage(RpcResult {
}) success: false,
.into_rpc_response(), data,
})
.into_rpc_response()
}
} }
} }
} }