(&mut self, request: HttpRequest)
| 337 | kind, |
| 338 | message: message.into(), |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | fn into_http_error(self) -> HttpError { |
| 343 | let kind = match self.kind { |
| 344 | HttpSubmitErrorKind::QueueClosed => HttpErrorKind::QueueClosed, |
| 345 | HttpSubmitErrorKind::InvalidRequest | HttpSubmitErrorKind::QueueFull => { |
| 346 | HttpErrorKind::Send |
| 347 | } |
| 348 | }; |
| 349 | HttpError::new(self.id, self.url, kind, self.message) |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | impl fmt::Display for HttpSubmitError { |
| 354 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 355 | write!(f, "{:?} {}: {}", self.kind, self.url, self.message) |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | impl std::error::Error for HttpSubmitError {} |
| 360 | |
| 361 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 362 | pub enum HttpEvent { |
| 363 | Completed(HttpResponse), |
no test coverage detected