update deprecated error handlers

This commit is contained in:
yggverse 2025-03-07 18:48:16 +02:00
parent 43c081d73b
commit 00d130e107
3 changed files with 6 additions and 15 deletions

View File

@ -74,20 +74,14 @@ impl Profile {
// Get active profile or create new one
let profile_id = Rc::new(match database.active()? {
Some(profile) => profile.id,
None => match database.add(true, DateTime::now_local()?, None) {
Ok(id) => id,
Err(e) => todo!("{:?}", e),
},
None => database.add(true, DateTime::now_local()?, None)?,
});
// Init components
let bookmark = Rc::new(Bookmark::build(&connection, &profile_id)?);
let history = Rc::new(History::build(&connection, &profile_id));
let search = Rc::new(Search::build(&connection, &profile_id)?); // @TODO handle
let identity = Rc::new(match Identity::build(&connection, &profile_id) {
Ok(result) => result,
Err(e) => todo!("{:?}", e.to_string()),
});
let search = Rc::new(Search::build(&connection, &profile_id)?);
let identity = Rc::new(Identity::build(&connection, &profile_id)?);
// Result
Ok(Self {

View File

@ -31,10 +31,7 @@ impl Identity {
profile_identity_id: &Rc<i64>,
) -> Result<Self> {
// Init components
let auth = match Auth::build(connection) {
Ok(auth) => Rc::new(auth),
Err(e) => bail!("Could not create auth: {e}"),
};
let auth = Rc::new(Auth::build(connection)?);
let database = Rc::new(Database::build(connection, profile_identity_id));
let memory = Rc::new(Memory::new());

View File

@ -1,3 +1,4 @@
use anyhow::Result;
use gtk::glib::DateTime;
use openssl::{
asn1::{Asn1Integer, Asn1Time},
@ -7,7 +8,6 @@ use openssl::{
rsa::Rsa,
x509::{X509Builder, X509Name},
};
use std::error::Error;
// Defaults
@ -19,7 +19,7 @@ pub const BITS: u32 = 2048;
pub fn generate(
time: (DateTime, DateTime), // valid (from, to)
name: &str,
) -> Result<String, Box<dyn Error>> {
) -> Result<String> {
// Generate new RSA key pair
let rsa = Rsa::generate(BITS)?;
let key = PKey::from_rsa(rsa)?;