7 7 | use std::error::Error;
|
8 8 |
|
9 9 | /// Diagnostic collector for endpoint resolution
|
10 10 | ///
|
11 11 | /// Endpoint functions return `Option<T>`—to enable diagnostic information to flow, we capture the
|
12 12 | /// last error that occurred.
|
13 13 | #[derive(Debug, Default)]
|
14 14 | pub(crate) struct DiagnosticCollector {
|
15 15 | last_error: Option<Box<dyn Error + Send + Sync>>,
|
16 16 | }
|
17 17 |
|
18 18 | impl DiagnosticCollector {
|
19 19 | #[allow(unused)]
|
20 20 | /// Report an error to the collector
|
21 21 | pub(crate) fn report_error(&mut self, err: impl Into<Box<dyn Error + Send + Sync>>) {
|
22 22 | self.last_error = Some(err.into());
|
23 23 | }
|
24 24 |
|
25 25 | #[allow(unused)]
|
26 26 | /// Capture a result, returning Some(t) when the input was `Ok` and `None` otherwise
|