mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
specify listener in error messages and logs
The "listening for incoming traffic on ..." log line is new, but something I've wanted even when we only supported one listener. I considered getting rid of `clippy::too_many_lines` by factoring out the construction of `app` to a separate function, but found that specifying it's type (or relevant traits) got quite hairy.
This commit is contained in:
parent
f7d7952f9b
commit
4f041f9153
3 changed files with 36 additions and 11 deletions
10
src/error.rs
10
src/error.rs
|
|
@ -4,6 +4,8 @@ use std::{fmt, iter, path::PathBuf};
|
|||
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::config::ListenConfig;
|
||||
|
||||
/// Formats an [`Error`][0] and its [`source`][1]s with a separator
|
||||
///
|
||||
/// [0]: std::error::Error
|
||||
|
|
@ -108,10 +110,10 @@ pub(crate) enum Serve {
|
|||
NoListeners,
|
||||
|
||||
#[error(
|
||||
"listener requested TLS, but no TLS cert was specified in the \
|
||||
"listener {0} requested TLS, but no TLS cert was specified in the \
|
||||
configuration file. Please set 'tls.certs' and 'tls.key'"
|
||||
)]
|
||||
NoTlsCerts,
|
||||
NoTlsCerts(ListenConfig),
|
||||
|
||||
#[error("failed to read TLS cert and key files at {certs:?} and {key:?}")]
|
||||
LoadCerts {
|
||||
|
|
@ -121,6 +123,6 @@ pub(crate) enum Serve {
|
|||
err: std::io::Error,
|
||||
},
|
||||
|
||||
#[error("failed to run request listener")]
|
||||
Listen(#[source] std::io::Error),
|
||||
#[error("failed to run request listener on {1}")]
|
||||
Listen(#[source] std::io::Error, ListenConfig),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue