mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
update errors handle
This commit is contained in:
parent
48ad344adc
commit
efa3bc48c3
9 changed files with 61 additions and 74 deletions
|
|
@ -25,11 +25,14 @@ impl Identity {
|
|||
|
||||
// Get active identity set for profile or create new one
|
||||
let profile_identity_id = Rc::new(match database.active() {
|
||||
Some(identity) => identity.id,
|
||||
None => match database.add(profile_id, true) {
|
||||
Ok(id) => id,
|
||||
Err(_) => return Err(Error::Database),
|
||||
Ok(result) => match result {
|
||||
Some(identity) => identity.id,
|
||||
None => match database.add(profile_id, true) {
|
||||
Ok(id) => id,
|
||||
Err(reason) => return Err(Error::DatabaseAdd(reason)),
|
||||
},
|
||||
},
|
||||
Err(reason) => return Err(Error::DatabaseActive(reason)),
|
||||
});
|
||||
|
||||
// Init gemini component
|
||||
|
|
@ -63,8 +66,8 @@ impl Identity {
|
|||
|
||||
pub fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
// Migrate self components
|
||||
if let Err(e) = database::init(tx) {
|
||||
return Err(e.to_string());
|
||||
if let Err(reason) = database::init(tx) {
|
||||
return Err(reason.to_string());
|
||||
}
|
||||
|
||||
// Delegate migration to childs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue