Skip to content

Commit 8c88734

Browse files
bors[bot]blckngm
andauthored
Merge #90
90: Use alternative display of errors, to show full error chian r=sopium a=sopium Co-authored-by: Guanhao Yin <sopium@mysterious.site>
2 parents b6e3af4 + 1162431 commit 8c88734

File tree

9 files changed

+19
-19
lines changed

9 files changed

+19
-19
lines changed

src/cli/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl Config<String> {
241241
endpoint, e
242242
);
243243
} else {
244-
warn!("failed to resolve {}: {}", endpoint, e);
244+
warn!("failed to resolve {}: {:#}", endpoint, e);
245245
}
246246
None
247247
}

src/cli/reload.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ pub async fn reload(wg: &Arc<WgState>, new_config: Config<SocketAddr>) -> anyhow
4141
if new_fwmark != current_state.fwmark {
4242
info!("setting fwmark");
4343
if let Err(e) = wg.set_fwmark(new_fwmark) {
44-
warn!("failed to set fwmark to {}: {}", new_fwmark, e);
44+
warn!("failed to set fwmark to {}: {:#}", new_fwmark, e);
4545
}
4646
}
4747

4848
let new_port = new_config.interface.listen_port.unwrap_or(0);
4949
if current_state.listen_port != new_port {
5050
info!("setting listen port");
5151
if let Err(e) = wg.set_port(new_port).await {
52-
warn!("failed to set port to {}: {}", new_port, e);
52+
warn!("failed to set port to {}: {:#}", new_port, e);
5353
}
5454
}
5555

src/cli/run.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async fn reload_on_sighup(
5252
info!("reloading");
5353
do_reload(config_file_path.clone(), &wg)
5454
.await
55-
.unwrap_or_else(|e| warn!("error in reloading: {}", e));
55+
.unwrap_or_else(|e| warn!("error in reloading: {:#}", e));
5656
}
5757
}
5858
}
@@ -71,7 +71,7 @@ pub async fn run(
7171
scope0.clone().spawn_canceller(async move {
7272
tokio::signal::ctrl_c()
7373
.await
74-
.unwrap_or_else(|e| warn!("ctrl_c failed: {}", e));
74+
.unwrap_or_else(|e| warn!("ctrl_c failed: {:#}", e));
7575
info!("Received SIGINT or Ctrl-C, shutting down.");
7676
});
7777

@@ -136,7 +136,7 @@ pub async fn run(
136136
scope0.clone().spawn_canceller(async move {
137137
reload_on_sighup(config_file_path, weak1)
138138
.await
139-
.unwrap_or_else(|e| warn!("error in reload_on_sighup: {}", e))
139+
.unwrap_or_else(|e| warn!("error in reload_on_sighup: {:#}", e))
140140
});
141141
}
142142

@@ -145,7 +145,7 @@ pub async fn run(
145145
scope0.clone().spawn_canceller(async move {
146146
ipc_server(weak, &dev_name, ready_tx)
147147
.await
148-
.unwrap_or_else(|e| error!("IPC server error: {}", e))
148+
.unwrap_or_else(|e| error!("IPC server error: {:#}", e))
149149
});
150150

151151
if ready_rx.await.is_ok() {
@@ -168,7 +168,7 @@ pub async fn run(
168168

169169
if c.general.foreground {
170170
super::systemd::notify_ready()
171-
.unwrap_or_else(|e| warn!("failed to notify systemd: {}", e));
171+
.unwrap_or_else(|e| warn!("failed to notify systemd: {:#}", e));
172172
} else {
173173
notify
174174
.unwrap()

src/ipc/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub async fn ipc_server(
4747
let stream = listener.accept().await?;
4848
tokio::spawn(async move {
4949
serve(&wg, stream).await.unwrap_or_else(|e| {
50-
warn!("Error serving IPC connection: {}", e);
50+
warn!("Error serving IPC connection: {:#}", e);
5151
});
5252
});
5353
}
@@ -80,7 +80,7 @@ pub async fn ipc_server(
8080
let wg = wg.clone();
8181
tokio::spawn(async move {
8282
serve(&wg, stream).await.unwrap_or_else(|e| {
83-
warn!("Error serving IPC connection: {}", e);
83+
warn!("Error serving IPC connection: {:#}", e);
8484
});
8585
});
8686
}
@@ -168,14 +168,14 @@ async fn process_wg_set(wg: &Arc<WgState>, command: WgSetCommand) -> io::Result<
168168
if let Some(p) = command.listen_port {
169169
info!("set listen port");
170170
wg.set_port(p).await.map_err(|e| {
171-
warn!("failed to set port: {}", e);
171+
warn!("failed to set port: {:#}", e);
172172
e
173173
})?;
174174
}
175175
if let Some(fwmark) = command.fwmark {
176176
info!("set fwmark");
177177
wg.set_fwmark(fwmark).map_err(|e| {
178-
warn!("failed to set fwmark: {}", e);
178+
warn!("failed to set fwmark: {:#}", e);
179179
e
180180
})?;
181181
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn main() {
176176
break;
177177
}
178178
Err(e) => {
179-
warn!("Error read from stdin: {}", e);
179+
warn!("Error read from stdin: {:#}", e);
180180
break;
181181
}
182182
_ => (),

src/wireguard/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,15 +682,15 @@ impl WgState {
682682
self.mtu.store(mtu, Ordering::Relaxed);
683683
}
684684
}
685-
Err(e) => warn!("failed to get mtu: {}", e),
685+
Err(e) => warn!("failed to get mtu: {:#}", e),
686686
}
687687
}
688688
}
689689

690690
/// TX. Tun -> Socket.
691691
pub async fn task_tx(self: Arc<WgState>) {
692692
match tun_packet_processing(self).await {
693-
Err(e) => error!("error in tx task: {}", e),
693+
Err(e) => error!("error in tx task: {:#}", e),
694694
_ => unreachable!(),
695695
}
696696
}

src/wireguard/tun_windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ unsafe impl Send for Tun {}
327327
impl Drop for Tun {
328328
fn drop(&mut self) {
329329
self.close()
330-
.unwrap_or_else(|e| warn!("failed to close tun: {}", e))
330+
.unwrap_or_else(|e| warn!("failed to close tun: {:#}", e))
331331
}
332332
}
333333

src/wireguard/tun_windows/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'a> Interface<'a> {
174174

175175
match Interface::new(dev_info, &mut dev_info_data, &WINTUN_POOL) {
176176
Err(e) => {
177-
warn!("failed Interface::new: {}", e);
177+
warn!("failed Interface::new: {:#}", e);
178178
continue;
179179
}
180180
Ok(w) => {

src/wireguard/tun_windows/pool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ impl Pool {
546546

547547
let wintun = match Interface::new(dev_info, &mut device_info_data, self) {
548548
Err(e) => {
549-
warn!("failed Interface::new: {}", e);
549+
warn!("failed Interface::new: {:#}", e);
550550
continue;
551551
}
552552
Ok(w) => w,
@@ -764,7 +764,7 @@ impl Pool {
764764

765765
let mut device_info_data = scopeguard::guard(device_info_data, |mut device_info_data| {
766766
remove_device(dev_info, &mut *device_info_data).unwrap_or_else(|e| {
767-
warn!("failed to remove device: {}", e);
767+
warn!("failed to remove device: {:#}", e);
768768
});
769769
});
770770

0 commit comments

Comments
 (0)