diff --git a/src/Helpers/WolframAlpha.hpp b/src/Helpers/WolframAlpha.hpp index 8472742..22dbda2 100644 --- a/src/Helpers/WolframAlpha.hpp +++ b/src/Helpers/WolframAlpha.hpp @@ -76,10 +76,10 @@ private: glz::json_t json{}; auto ec = glz::read_json(json, response.text); - if (ec != glz::error_code::missing_key) { + if (ec != glz::error_code::parse_error && json["queryresult"]["success"].get_boolean()) { return json["queryresult"]["pods"][1]["subpods"][0]["plaintext"].get(); } else { - throw std::invalid_argument("JSON Key not found"); + throw std::invalid_argument("WolframAlpha query failed"); } }