message: Clean up ApiError refactor
diff: +use serde::{Deserialize, Serialize};
  use snafu::Snafu;
  #[derive(Debug, Snafu)]
  @@ -77,19 +78,16 @@ pub fn unauthorized<T>() -> Result<T> {
  Unauthorized {}.fail()
  }
  -pub use api::ApiError;
  -
  -// place this in a submod, so the auto-generated contexts don't conflict with same-named context from above
  -mod api {
  - use super::Error;
  - use serde::{Deserialize, Serialize};
  -
  - /// ApiError is a "rehydrated" Error after it has been Serialized and restored.
  +/// ApiError is a "converted" Error that can be serialized and deserialized.
  +/// It can be created via `error.into()`
  /// This will not contain all information of the original (source error and backtrace cannot be serialized),
  - /// but we aim to ensure the following:
  - /// 1. A rehydrated ApiError will have the same type as the original Error
  - /// 2. A rehydrated ApiError will have the same display as the original
  - /// 3. Serializing and Deserializing an ApiError will give you an identical struct
  +/// but we ensure the following:
  +/// 1. An ApiError will have the same type as the original Error
  +/// 2. An ApiError will have the same display as the original
  +/// 3. Serializing and deserializing an ApiError will give you an identical struct
  +///
  +/// Rather than use Display to pass Errors over API/FFI boundaries, we can use ApiError
  +/// and provide much more context to the client.
  #[derive(Debug, Serialize, Deserialize, PartialEq)]
  pub enum ApiError {
  Base64Err { source: String },
  @@ -115,9 +113,7 @@ mod api {
  ApiError::DynContractErr { msg } => write!(f, "Contract error: {}", msg),
  ApiError::NotFound { kind } => write!(f, "{} not found", kind),
  ApiError::NullPointer {} => write!(f, "Received null pointer, refuse to use"),
  - ApiError::ParseErr { kind, source } => {
  - write!(f, "Error parsing {}: {}", kind, source)
  - }
  + ApiError::ParseErr { kind, source } => write!(f, "Error parsing {}: {}", kind, source),
  ApiError::SerializeErr { kind, source } => {
  write!(f, "Error serializing {}: {}", kind, source)
  }
  @@ -165,7 +161,6 @@ mod api {
  }
  }
  }
  -}
  #[cfg(test)]
  mod test {
  