Skip to content

Commit

Permalink
GeoLocation: Fix 'warning: catching polymorphic type'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Jul 27, 2024
1 parent d7ad391 commit 0b54e9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/infclassr/geolocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bool Geolocation::Initialize(const char *pPathToDB)
Instance = new Geolocation(pPathToDB);
return true;
}
catch (std::system_error e)
catch(const std::system_error &e)
{
std::cout << "Geolocation::Initialize() failed: " << e.what() << std::endl;
return false;
Expand All @@ -45,10 +45,10 @@ int Geolocation::get_country_iso_numeric_code(std::string& ip) {
try {
GeoLite2PP::MStr map_str = Instance->db->get_all_fields(ip);
return Instance->get_iso_numeric_code(map_str);
} catch (std::invalid_argument) {
} catch (const std::invalid_argument &) {
std::cout << "This ip is not valid! " << ip << std::endl;
return -1;
} catch (std::length_error) {
} catch (const std::length_error &) {
std::cout << "This ip was not found in database: " << ip << std::endl;
return -1;
} catch (...) {
Expand Down

0 comments on commit 0b54e9e

Please sign in to comment.