mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
gpui: Include image URI in ImageCacheError::BadStatus
(#14910)
This PR updates the `ImageCacheError::BadStatus` variant to include the URI of the image that failed to load. This helps contextualize the resulting error logs. Release Notes: - N/A
This commit is contained in:
parent
70f7f2d2da
commit
c7331b41e9
@ -375,6 +375,7 @@ impl Asset for Image {
|
|||||||
response.body_mut().read_to_end(&mut body).await?;
|
response.body_mut().read_to_end(&mut body).await?;
|
||||||
if !response.status().is_success() {
|
if !response.status().is_success() {
|
||||||
return Err(ImageCacheError::BadStatus {
|
return Err(ImageCacheError::BadStatus {
|
||||||
|
uri,
|
||||||
status: response.status(),
|
status: response.status(),
|
||||||
body: String::from_utf8_lossy(&body).into_owned(),
|
body: String::from_utf8_lossy(&body).into_owned(),
|
||||||
});
|
});
|
||||||
@ -417,8 +418,10 @@ pub enum ImageCacheError {
|
|||||||
#[error("IO error: {0}")]
|
#[error("IO error: {0}")]
|
||||||
Io(Arc<std::io::Error>),
|
Io(Arc<std::io::Error>),
|
||||||
/// An error that occurred while processing an image.
|
/// An error that occurred while processing an image.
|
||||||
#[error("unexpected http status: {status}, body: {body}")]
|
#[error("unexpected http status for {uri}: {status}, body: {body}")]
|
||||||
BadStatus {
|
BadStatus {
|
||||||
|
/// The URI of the image.
|
||||||
|
uri: SharedUri,
|
||||||
/// The HTTP status code.
|
/// The HTTP status code.
|
||||||
status: http::StatusCode,
|
status: http::StatusCode,
|
||||||
/// The HTTP response body.
|
/// The HTTP response body.
|
||||||
|
Loading…
Reference in New Issue
Block a user