diff --git a/src/profile/identity.rs b/src/profile/identity.rs index dc1cc838..0b05832c 100644 --- a/src/profile/identity.rs +++ b/src/profile/identity.rs @@ -3,7 +3,7 @@ mod error; mod gemini; use database::Database; -use error::Error; +pub use error::Error; use gemini::Gemini; use sqlite::{Connection, Transaction}; @@ -35,7 +35,7 @@ impl Identity { // Init gemini component let gemini = Rc::new(match Gemini::new(connection, profile_identity_id) { Ok(result) => result, - Err(_) => return Err(Error::Gemini), + Err(reason) => return Err(Error::Gemini(reason)), }); // Done diff --git a/src/profile/identity/error.rs b/src/profile/identity/error.rs index fdf54de4..df63c32a 100644 --- a/src/profile/identity/error.rs +++ b/src/profile/identity/error.rs @@ -1,5 +1,5 @@ #[derive(Debug)] pub enum Error { Database, - Gemini, + Gemini(super::gemini::Error), } diff --git a/src/profile/identity/gemini.rs b/src/profile/identity/gemini.rs index 0a606157..e0e04cd4 100644 --- a/src/profile/identity/gemini.rs +++ b/src/profile/identity/gemini.rs @@ -6,7 +6,7 @@ mod memory; use auth::Auth; use database::Database; -use error::Error; +pub use error::Error; use memory::Memory; @@ -34,7 +34,7 @@ impl Gemini { // Init components let auth = match Auth::new(connection.clone()) { Ok(auth) => Rc::new(auth), - Err(_) => return Err(Error::AuthInit), // @TODO + Err(reason) => return Err(Error::AuthInit(reason)), // @TODO }; let database = Rc::new(Database::new(connection, profile_identity_id.clone())); let memory = Rc::new(Memory::new()); diff --git a/src/profile/identity/gemini/auth.rs b/src/profile/identity/gemini/auth.rs index 69796cdf..61891b14 100644 --- a/src/profile/identity/gemini/auth.rs +++ b/src/profile/identity/gemini/auth.rs @@ -5,7 +5,7 @@ mod error; mod memory; use database::Database; -use error::Error; +pub use error::Error; use memory::Memory; use sqlite::{Connection, Transaction}; @@ -85,12 +85,11 @@ impl Auth { match self.database.records(None) { Ok(records) => { for record in records { - if self + if let Err(reason) = self .memory .add(record.url, record.profile_identity_gemini_id) - .is_err() { - return Err(Error::MemoryIndex); + return Err(Error::Memory(reason)); } } } diff --git a/src/profile/identity/gemini/auth/error.rs b/src/profile/identity/gemini/auth/error.rs index 73199a89..3b510002 100644 --- a/src/profile/identity/gemini/auth/error.rs +++ b/src/profile/identity/gemini/auth/error.rs @@ -4,5 +4,5 @@ pub enum Error { DatabaseRecordCreate(i64, String), DatabaseRecordDelete(i64), DatabaseRecordsRead(String), - MemoryIndex, + Memory(super::memory::Error), } diff --git a/src/profile/identity/gemini/auth/memory.rs b/src/profile/identity/gemini/auth/memory.rs index 3a080ba8..e9ef386d 100644 --- a/src/profile/identity/gemini/auth/memory.rs +++ b/src/profile/identity/gemini/auth/memory.rs @@ -1,5 +1,5 @@ mod error; -use error::Error; +pub use error::Error; use std::{cell::RefCell, collections::HashMap}; diff --git a/src/profile/identity/gemini/error.rs b/src/profile/identity/gemini/error.rs index 23129df7..1bd9114b 100644 --- a/src/profile/identity/gemini/error.rs +++ b/src/profile/identity/gemini/error.rs @@ -1,6 +1,6 @@ #[derive(Debug)] pub enum Error { - AuthInit, + AuthInit(super::auth::Error), DatabaseIndex, DatabaseRecordCreate, MemoryIndex,