chore(types): Refactor ErrorDetails constructor (#1218)
This commit is contained in:
@@ -11,7 +11,7 @@ pub(crate) mod vec;
|
|||||||
/// Used when extracting error details from `tonic::Status`, and when
|
/// Used when extracting error details from `tonic::Status`, and when
|
||||||
/// creating a `tonic::Status` with error details.
|
/// creating a `tonic::Status` with error details.
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct ErrorDetails {
|
pub struct ErrorDetails {
|
||||||
/// This field stores [`RetryInfo`] data, if any.
|
/// This field stores [`RetryInfo`] data, if any.
|
||||||
pub(crate) retry_info: Option<RetryInfo>,
|
pub(crate) retry_info: Option<RetryInfo>,
|
||||||
@@ -37,12 +37,7 @@ impl ErrorDetails {
|
|||||||
/// let err_details = ErrorDetails::new();
|
/// let err_details = ErrorDetails::new();
|
||||||
/// ```
|
/// ```
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
ErrorDetails {
|
Self::default()
|
||||||
retry_info: None,
|
|
||||||
debug_info: None,
|
|
||||||
quota_failure: None,
|
|
||||||
bad_request: None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates an [`ErrorDetails`] struct with [`RetryInfo`] details and
|
/// Generates an [`ErrorDetails`] struct with [`RetryInfo`] details and
|
||||||
@@ -370,9 +365,3 @@ impl ErrorDetails {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ErrorDetails {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user