Skip to content
This repository has been archived by the owner on Jun 28, 2020. It is now read-only.

Commit

Permalink
Impl From<NoneError> for Error
Browse files Browse the repository at this point in the history
  • Loading branch information
elegaanz committed Oct 7, 2018
1 parent cc26880 commit d19f7bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![feature(try_trait)]

extern crate serde;

use serde::{Serialize, de::DeserializeOwned};
use std::fmt::Display;
use std::option::NoneError;

pub enum Error {
Fetch(String),
Expand All @@ -10,6 +13,12 @@ pub enum Error {
Authorization(String),
}

impl From<NoneError> for Error {
fn from(_: NoneError) -> Error {
Error::NotFound(String::from("Expected a value, found None"))
}
}

/// API to DB link
///
/// `E` is the endpoint (API)
Expand Down

0 comments on commit d19f7bf

Please sign in to comment.