dispatch.rs 425 B

123456789101112
  1. use crate::FlowyError;
  2. use bytes::Bytes;
  3. use lib_dispatch::prelude::{AFPluginEventResponse, ResponseBuilder};
  4. use std::convert::TryInto;
  5. impl lib_dispatch::Error for FlowyError {
  6. fn as_response(&self) -> AFPluginEventResponse {
  7. let bytes: Bytes = self.clone().try_into().unwrap();
  8. println!("Serialize FlowyError: {:?} to event response", self);
  9. ResponseBuilder::Err().data(bytes).build()
  10. }
  11. }