Skip to content

Commit

Permalink
exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
RynTurtle committed Sep 15, 2024
1 parent ed41082 commit a6d71a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <windows.h>
#include <fstream>
#include <nlohmann/json.hpp>

#include <exception>
#include <stdexcept>

// 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(){
Expand Down Expand Up @@ -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();
}

}
}
1 change: 1 addition & 0 deletions request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a6d71a2

Please sign in to comment.