diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 27397f0..bf1d53d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,12 +9,19 @@ int main() { "postgresql://aotrix@localhost:5432/hearthstonegameinfo"}; pqxx::work tx{cx}; - const unsigned int card_id = 217; - std::string card = - hs_handler.get_cards(std::format("/{}?locale=fr_FR", card_id)); - std::cout << card << std::endl; - add_cards_to_database(card, tx); - - tx.commit(); + try { + std::string cards = hs_handler.get_cards( + "/108499?locale=fr_FR&gameMode=constructed&pageSize=2"); + std::cout << cards << std::endl; + add_cards_to_database(cards, tx); + tx.commit(); + } catch (pqxx::sql_error const &e) { + std::cerr << "SQL error: " << e.what() << std::endl; + std::cerr << "Query was: " << e.query() << std::endl; + return 2; + } catch (std::exception const &e) { + std::cerr << "Error: " << e.what() << std::endl; + return 1; + } return 0; } |
