| 29 | impl<T> ErrorExt for T where T: StackError {} |
| 30 | |
| 31 | pub trait StackError: std::error::Error { |
| 32 | fn debug_fmt(&self, layer: usize, buf: &mut Vec<String>); |
| 33 | |
| 34 | fn next(&self) -> Option<&dyn StackError>; |
| 35 | |
| 36 | fn last(&self) -> &dyn StackError |
| 37 | where |
| 38 | Self: Sized, |
| 39 | { |
| 40 | let Some(mut result) = self.next() else { |
| 41 | return self; |
| 42 | }; |
| 43 | while let Some(err) = result.next() { |
| 44 | result = err; |
| 45 | } |
| 46 | result |
| 47 | } |
| 48 | |
| 49 | /// Indicates whether this error is "transparent", that it delegates its "display" and "source" |
| 50 | /// to the underlying error. Could be useful when you are just wrapping some external error, |
| 51 | /// **AND** can not or would not provide meaningful contextual info. For example, the |
| 52 | /// `DataFusionError`. |
| 53 | fn transparent(&self) -> bool { |
| 54 | false |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | impl<T: ?Sized + StackError> StackError for Arc<T> { |
| 59 | fn debug_fmt(&self, layer: usize, buf: &mut Vec<String>) { |
no outgoing calls
no test coverage detected