add explanative debug messages to parse errors in GetPidVid

This commit is contained in:
Lion Kortlepel 2022-11-10 18:52:37 +01:00
parent dff94a41be
commit 13a86d3e77
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -34,13 +34,15 @@ static std::optional<std::pair<int, int>> GetPidVid(const std::string& str) {
if (pid.find_first_not_of("0123456789") == std::string::npos && vid.find_first_not_of("0123456789") == std::string::npos) { if (pid.find_first_not_of("0123456789") == std::string::npos && vid.find_first_not_of("0123456789") == std::string::npos) {
try { try {
int PID = stoi(pid); int PID = std::stoi(pid);
int VID = stoi(vid); int VID = std::stoi(vid);
return { { PID, VID } }; return { { PID, VID } };
} catch (const std::exception&) { } catch (const std::exception&) {
beammp_debugf("Invalid packet: Could not parse pid/vid from packet, as one or both are not valid numbers: '{}'", str);
return std::nullopt; return std::nullopt;
} }
} }
beammp_debugf("Invalid packet: Could not parse pid/vid from packet: '{}'", str);
return std::nullopt; return std::nullopt;
} }