mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
delegate some errors to the up level
This commit is contained in:
parent
5effd63575
commit
43c081d73b
3 changed files with 6 additions and 9 deletions
|
|
@ -72,9 +72,9 @@ impl Profile {
|
||||||
let database = Rc::new(Database::build(&connection));
|
let database = Rc::new(Database::build(&connection));
|
||||||
|
|
||||||
// Get active profile or create new one
|
// Get active profile or create new one
|
||||||
let profile_id = Rc::new(match database.active().unwrap() {
|
let profile_id = Rc::new(match database.active()? {
|
||||||
Some(profile) => profile.id,
|
Some(profile) => profile.id,
|
||||||
None => match database.add(true, DateTime::now_local().unwrap(), None) {
|
None => match database.add(true, DateTime::now_local()?, None) {
|
||||||
Ok(id) => id,
|
Ok(id) => id,
|
||||||
Err(e) => todo!("{:?}", e),
|
Err(e) => todo!("{:?}", e),
|
||||||
},
|
},
|
||||||
|
|
@ -83,7 +83,7 @@ impl Profile {
|
||||||
// Init components
|
// Init components
|
||||||
let bookmark = Rc::new(Bookmark::build(&connection, &profile_id)?);
|
let bookmark = Rc::new(Bookmark::build(&connection, &profile_id)?);
|
||||||
let history = Rc::new(History::build(&connection, &profile_id));
|
let history = Rc::new(History::build(&connection, &profile_id));
|
||||||
let search = Rc::new(Search::build(&connection, &profile_id).unwrap()); // @TODO handle
|
let search = Rc::new(Search::build(&connection, &profile_id)?); // @TODO handle
|
||||||
let identity = Rc::new(match Identity::build(&connection, &profile_id) {
|
let identity = Rc::new(match Identity::build(&connection, &profile_id) {
|
||||||
Ok(result) => result,
|
Ok(result) => result,
|
||||||
Err(e) => todo!("{:?}", e.to_string()),
|
Err(e) => todo!("{:?}", e.to_string()),
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,7 @@ impl Bookmark {
|
||||||
}
|
}
|
||||||
// Otherwise, create new record
|
// Otherwise, create new record
|
||||||
} else {
|
} else {
|
||||||
match self
|
match self.database.add(DateTime::now_local()?, request.into()) {
|
||||||
.database
|
|
||||||
.add(DateTime::now_local().unwrap(), request.into())
|
|
||||||
{
|
|
||||||
Ok(id) => match self.memory.add(request.into(), id) {
|
Ok(id) => match self.memory.add(request.into(), id) {
|
||||||
Ok(_) => Ok(true),
|
Ok(_) => Ok(true),
|
||||||
Err(_) => panic!(), // unexpected
|
Err(_) => panic!(), // unexpected
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ impl Identity {
|
||||||
match time {
|
match time {
|
||||||
Some(value) => value,
|
Some(value) => value,
|
||||||
None => (
|
None => (
|
||||||
DateTime::now_local().unwrap(),
|
DateTime::now_local()?,
|
||||||
DateTime::from_local(9999, 12, 31, 23, 59, 59.9).unwrap(), // max @TODO
|
DateTime::from_local(9999, 12, 31, 23, 59, 59.9)?, // max @TODO
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
name,
|
name,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue