From a6d71a2f7b18b4099721e481a8d98c1d26af3b44 Mon Sep 17 00:00:00 2001 From: wettortoise Date: Sun, 15 Sep 2024 19:57:48 +0100 Subject: [PATCH] exception handling --- main.cpp | 11 +++++++++-- request.cpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 5f99746..3a217c5 100644 --- a/main.cpp +++ b/main.cpp @@ -6,7 +6,8 @@ #include #include #include - +#include +#include // todo - will need to add a search for singles/compilation/ep function, not sure if i still want this feature but its here if i change my mind void current_albums(){ @@ -191,6 +192,12 @@ int main() { check_tokens_and_verify_authentication(); while (true){ - random_albums(20); + try{ + random_albums(20); + } + catch(const std::exception &exc){ + std::cerr << exc.what(); + } + } } diff --git a/request.cpp b/request.cpp index 7de1e3f..588e17a 100644 --- a/request.cpp +++ b/request.cpp @@ -71,6 +71,7 @@ nlohmann::json get_request(std::string url, bool header){ } // if nothing is returned then give an error + std::cout << "didnt return anything when making request for some reason"; throw; }