mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
enshort to common variable name
This commit is contained in:
parent
dd5fada7c7
commit
293c7d0aa3
15 changed files with 69 additions and 69 deletions
|
|
@ -46,8 +46,8 @@ impl Profile {
|
|||
env!("CARGO_PKG_VERSION_MINOR")
|
||||
)); // @TODO remove after auto-migrate feature implementation
|
||||
|
||||
if let Err(reason) = create_dir_all(&config_path) {
|
||||
panic!("{reason}")
|
||||
if let Err(e) = create_dir_all(&config_path) {
|
||||
panic!("{e}")
|
||||
}
|
||||
|
||||
// Init database path
|
||||
|
|
@ -57,7 +57,7 @@ impl Profile {
|
|||
// Init database connection
|
||||
let connection = match Connection::open(database_path.as_path()) {
|
||||
Ok(connection) => Rc::new(RwLock::new(connection)),
|
||||
Err(reason) => panic!("{reason}"),
|
||||
Err(e) => panic!("{e}"),
|
||||
};
|
||||
|
||||
// Init profile components
|
||||
|
|
@ -65,24 +65,24 @@ impl Profile {
|
|||
// Init writable connection
|
||||
let mut connection = match connection.write() {
|
||||
Ok(connection) => connection,
|
||||
Err(reason) => todo!("{reason}"),
|
||||
Err(e) => todo!("{e}"),
|
||||
};
|
||||
|
||||
// Init new transaction
|
||||
let transaction = match connection.transaction() {
|
||||
Ok(transaction) => transaction,
|
||||
Err(reason) => todo!("{reason}"),
|
||||
Err(e) => todo!("{e}"),
|
||||
};
|
||||
|
||||
// Begin migration
|
||||
match migrate(&transaction) {
|
||||
Ok(_) => {
|
||||
// Confirm changes
|
||||
if let Err(reason) = transaction.commit() {
|
||||
todo!("{reason}")
|
||||
if let Err(e) = transaction.commit() {
|
||||
todo!("{e}")
|
||||
}
|
||||
}
|
||||
Err(reason) => todo!("{reason}"),
|
||||
Err(e) => todo!("{e}"),
|
||||
}
|
||||
} // unlock database
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ impl Profile {
|
|||
Some(profile) => profile.id,
|
||||
None => match database.add(true, DateTime::now_local().unwrap(), None) {
|
||||
Ok(id) => id,
|
||||
Err(reason) => todo!("{:?}", reason),
|
||||
Err(e) => todo!("{:?}", e),
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ impl Profile {
|
|||
// Init identity component
|
||||
let identity = Rc::new(match Identity::new(connection, profile_id) {
|
||||
Ok(result) => result,
|
||||
Err(reason) => todo!("{:?}", reason.to_string()),
|
||||
Err(e) => todo!("{:?}", e.to_string()),
|
||||
});
|
||||
|
||||
// Result
|
||||
|
|
@ -119,8 +119,8 @@ impl Profile {
|
|||
|
||||
pub fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
// Migrate self components
|
||||
if let Err(reason) = database::init(tx) {
|
||||
return Err(reason.to_string());
|
||||
if let Err(e) = database::init(tx) {
|
||||
return Err(e.to_string());
|
||||
}
|
||||
|
||||
// Delegate migration to children components
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue