Skip to content

Commit 1477c9e

Browse files
committed
Do not log ERROR on directory validation errors
Application validation errors generally shouldn't get log'd as an `ERROR`. The `ERROR` catagory should be reserved for internal server failures. Issue: payjoin#627
1 parent e2a6f45 commit 1477c9e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

payjoin-directory/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use hyper_util::rt::TokioIo;
1515
use payjoin::directory::{ShortId, ShortIdError, ENCAPSULATED_MESSAGE_BYTES};
1616
use tokio::net::TcpListener;
1717
use tokio::sync::Mutex;
18-
use tracing::{debug, error, trace};
18+
use tracing::{debug, error, trace, warn};
1919

2020
use crate::db::DbPool;
2121
pub mod key_config;
@@ -287,14 +287,14 @@ impl HandlerError {
287287
HandlerError::OhttpKeyRejection(e) => {
288288
const OHTTP_KEY_REJECTION_RES_JSON: &str = r#"{"type":"https://iana.org/assignments/http-problem-types#ohttp-key", "title": "key identifier unknown"}"#;
289289

290-
error!("Bad request: Key configuration rejected: {}", e);
290+
warn!("Bad request: Key configuration rejected: {}", e);
291291
*res.status_mut() = StatusCode::BAD_REQUEST;
292292
res.headers_mut()
293293
.insert(CONTENT_TYPE, HeaderValue::from_static("application/problem+json"));
294294
*res.body_mut() = full(OHTTP_KEY_REJECTION_RES_JSON);
295295
}
296296
HandlerError::BadRequest(e) => {
297-
error!("Bad request: {}", e);
297+
warn!("Bad request: {}", e);
298298
*res.status_mut() = StatusCode::BAD_REQUEST
299299
}
300300
};

0 commit comments

Comments
 (0)