Add an error management in db module

This commit is contained in:
Greg Burri 2020-06-24 23:52:41 +02:00
parent e2e54b8f43
commit a080d19cb9
6 changed files with 387 additions and 280 deletions

View file

@ -39,7 +39,6 @@ async fn home_page(req: HttpRequest) -> impl Responder {
#[get("/recipe/view/{id}")]
async fn view_page(req: HttpRequest, path: web::Path<(i32,)>) -> impl Responder {
panic!("ERROR");
ViewRecipeTemplate { recipes: vec![ db::Recipe { title: String::from("Saumon en croûte feuilletée"), id: 1 }, db::Recipe { title: String::from("Croissant au jambon"), id: 2 } ], current_recipe: db::Recipe { title: String::from("Saumon en croûte feuilletée"), id: 1 } }
}
@ -108,7 +107,10 @@ fn process_args() -> bool {
print_usage();
return true
} else if args.iter().any(|arg| arg == "--test") {
let db_connection = db::Connection::new();
match db::Connection::new() {
Ok(_) => (),
Err(error) => println!("Error: {:?}", error)
}
return true
}