handle error details

This commit is contained in:
yggverse 2024-11-20 10:09:11 +02:00
parent b7900489b0
commit fa9c2b4fbc
2 changed files with 6 additions and 6 deletions

View File

@ -80,7 +80,7 @@ impl Gemini {
self.index()?;
Ok(profile_identity_gemini_id)
}
Err(_) => Err(Error::DatabaseRecordCreate),
Err(reason) => Err(Error::DatabaseRecordCreate(reason)),
},
Err(reason) => Err(Error::Certificate(reason)),
}
@ -96,11 +96,11 @@ impl Gemini {
Ok(records) => {
for record in records {
if self.memory.add(record.id, record.pem).is_err() {
return Err(Error::MemoryIndex); // @TODO
return Err(Error::MemoryIndex(record.id));
}
}
}
Err(_) => return Err(Error::DatabaseIndex), // @TODO
Err(reason) => return Err(Error::DatabaseIndex(reason)),
};
Ok(()) // @TODO
}

View File

@ -1,8 +1,8 @@
#[derive(Debug)]
pub enum Error {
AuthInit(super::auth::Error),
DatabaseIndex,
DatabaseRecordCreate,
MemoryIndex,
DatabaseIndex(sqlite::Error),
DatabaseRecordCreate(sqlite::Error),
MemoryIndex(i64),
Certificate(Box<dyn std::error::Error>),
}