| 2192 | |
| 2193 | #[tokio::test] |
| 2194 | async fn check_error_nesting() { |
| 2195 | let once_fut = OnceFut::<()>::new(async { |
| 2196 | arrow_err!(ArrowError::CsvError("some error".to_string())) |
| 2197 | }); |
| 2198 | |
| 2199 | struct TestFut(OnceFut<()>); |
| 2200 | impl Future for TestFut { |
| 2201 | type Output = ArrowResult<()>; |
| 2202 | |
| 2203 | fn poll( |
| 2204 | mut self: Pin<&mut Self>, |
| 2205 | cx: &mut Context<'_>, |
| 2206 | ) -> Poll<Self::Output> { |
| 2207 | match ready!(self.0.get(cx)) { |
| 2208 | Ok(()) => Poll::Ready(Ok(())), |
| 2209 | Err(e) => Poll::Ready(Err(e.into())), |
| 2210 | } |
| 2211 | } |
| 2212 | } |
| 2213 | |
| 2214 | let res = TestFut(once_fut).await; |
| 2215 | let arrow_err_from_fut = res.expect_err("once_fut always return error"); |
| 2216 | |
| 2217 | let wrapped_err = DataFusionError::from(arrow_err_from_fut); |
| 2218 | let root_err = wrapped_err.find_root(); |
| 2219 | |
| 2220 | let _expected = |
| 2221 | arrow_datafusion_err!(ArrowError::CsvError("some error".to_owned())); |
| 2222 | |
| 2223 | assert!(matches!(root_err, _expected)) |
| 2224 | } |
| 2225 | |
| 2226 | #[test] |
| 2227 | fn check_not_in_left() { |