Skip to content

Commit 1680f77

Browse files
authored
Add response status code to FetchApiRootUrlError.ApiRootLinkHeaderNotFound (#247)
1 parent 28dac79 commit 1680f77

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

wp_api/src/login/url_discovery.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl StateParsedUrl {
123123
}),
124124
None => Err(FetchApiRootUrlError::ApiRootLinkHeaderNotFound {
125125
header_map: response.header_map,
126+
status_code: response.status_code,
126127
}),
127128
}
128129
}
@@ -180,16 +181,23 @@ pub(super) struct StateFetchedApiDetails {
180181
#[derive(Debug, thiserror::Error, uniffi::Error)]
181182
pub enum FetchApiRootUrlError {
182183
#[error(
183-
"Request execution failed!\nStatus Code: '{:?}'.\nResponse: '{}'",
184+
"Request execution failed!\nStatus Code: '{:?}'\nResponse: '{}'",
184185
status_code,
185186
reason
186187
)]
187188
RequestExecutionFailed {
188189
status_code: Option<u16>,
189190
reason: String,
190191
},
191-
#[error("Api root link header not found in header_map: {:?}", header_map)]
192-
ApiRootLinkHeaderNotFound { header_map: Arc<WpNetworkHeaderMap> },
192+
#[error(
193+
"Api root link header not found!\nStatus Code: '{:#?}'\nHeader Map: '{:#?}'",
194+
status_code,
195+
header_map
196+
)]
197+
ApiRootLinkHeaderNotFound {
198+
header_map: Arc<WpNetworkHeaderMap>,
199+
status_code: u16,
200+
},
193201
}
194202

195203
impl From<RequestExecutionError> for FetchApiRootUrlError {

0 commit comments

Comments
 (0)