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