()
| 584 | |
| 585 | #[tokio::test] |
| 586 | async fn rich_errors_handle_serialization_errors() { |
| 587 | struct AlwaysErrors; |
| 588 | impl Serialize for AlwaysErrors { |
| 589 | fn serialize<S>(&self, _: S) -> Result<S::Ok, S::Error> |
| 590 | where |
| 591 | S: serde::Serializer, |
| 592 | { |
| 593 | Err(ser::Error::custom("error")) |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | let response = rich_error("foo", "bar", AlwaysErrors).into_response(); |
| 598 | // SAFETY: usize::MAX is ok here because it's a test |
| 599 | let bytes = axum::body::to_bytes(response.into_body(), usize::MAX) |
| 600 | .await |
| 601 | .unwrap(); |
| 602 | |
| 603 | assert_eq!( |
| 604 | serde_json::from_slice::<serde_json::Value>(&bytes).unwrap(), |
| 605 | json!({ |
| 606 | "errorType": "foo", |
| 607 | "description": "bar", |
| 608 | }) |
| 609 | ); |
| 610 | } |
| 611 | |
| 612 | #[tokio::test] |
| 613 | async fn maps_known_solver_errors_to_bad_request_responses() { |
nothing calls this directly
no test coverage detected