Skip to content

Commit

Permalink
use debug for printing errors instead of display (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryeprecision authored Apr 27, 2024
1 parent dd8ac6c commit 5fb2e32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/cache/level/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl RedisCache {
.get(key)
.await
.unwrap_or_else(|err| {
error!("Failed to get value from redis: {}", err);
error!("Failed to get value from redis: {:?}", err);
None
})
}
Expand All @@ -84,7 +84,7 @@ impl RedisCache {
)
.await
.unwrap_or_else(|err| {
error!("Failed to set value to redis: {}", err);
error!("Failed to set value to redis: {:?}", err);
});
}
}
Expand Down
16 changes: 10 additions & 6 deletions src/mojang/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,22 @@ impl MojangApi {
})
.await
.map_err(|err| {
warn!("failed to fetch uuids: {}", err);
warn!("failed to fetch uuids: {:?}", err);
Unavailable
})?;

match response.status() {
StatusCode::NOT_FOUND | StatusCode::NO_CONTENT => Ok(vec![]),
StatusCode::OK => response.json().await.map_err(|err| {
error!("failed to read body (username_resolved): {}", err);
error!("failed to read body (username_resolved): {:?}", err);
Unavailable
}),
code => {
warn!(status = code.as_str(), "{:?}", response.text().await.ok());
warn!(
status = code.as_str(),
"{:?}",
response.text().await.unwrap_or(String::new())
);
Err(Unavailable)
}
}
Expand Down Expand Up @@ -121,14 +125,14 @@ impl Mojang for MojangApi {
})
.await
.map_err(|err| {
warn!("failed to fetch profile: {}", err);
warn!("failed to fetch profile: {:?}", err);
Unavailable
})?;

match response.status() {
StatusCode::NOT_FOUND | StatusCode::NO_CONTENT => Err(NotFound),
StatusCode::OK => response.json().await.map_err(|err| {
error!("failed to read body (profile): {}", err);
error!("failed to read body (profile): {:?}", err);
Unavailable
}),
code => {
Expand All @@ -150,7 +154,7 @@ impl Mojang for MojangApi {
match response.status() {
StatusCode::NOT_FOUND | StatusCode::NO_CONTENT => Err(NotFound),
StatusCode::OK => response.bytes().await.map_err(|err| {
error!("failed to read body (bytes): {}", err);
error!("failed to read body (bytes): {:?}", err);
Unavailable
}),
code => {
Expand Down

0 comments on commit 5fb2e32

Please sign in to comment.