error.rs 496 B

123456789101112131415161718192021
  1. use crate::{ethereum, protocol};
  2. #[derive(Debug, thiserror::Error)]
  3. pub enum Error {
  4. #[error("protocol error: {0}")]
  5. ProtocolError(#[source] protocol::Error),
  6. #[error("ethereum error: {0}")]
  7. EthereumError(#[source] ethereum::Error),
  8. }
  9. impl From<protocol::Error> for Error {
  10. fn from(e: protocol::Error) -> Self {
  11. Error::ProtocolError(e)
  12. }
  13. }
  14. impl From<ethereum::Error> for Error {
  15. fn from(e: ethereum::Error) -> Self {
  16. Error::EthereumError(e)
  17. }
  18. }