handle all exceptions which happen inside a logging macro

and print them ;)
This commit is contained in:
Lion Kortlepel
2022-11-10 19:13:43 +01:00
parent 13a86d3e77
commit 3bd67d959f
3 changed files with 80 additions and 32 deletions

View File

@@ -57,11 +57,11 @@ static std::optional<VehiclePacket> ParseVehiclePacket(const std::string& Packet
auto NameDataSep = withoutCode.find(':', 3);
if (NameDataSep == std::string::npos) {
// invalid packet
beammp_debugf("Invalid packet from {} in ParseVehiclePacket: No ':' separator, assuming corrupted packet. Packet: '{}'", playerID, Packet);
return std::nullopt;
}
if (NameDataSep + 1 > withoutCode.size()) {
// invalid packet
beammp_debugf("Invalid packet from {} in ParseVehiclePacket: Separator in unexpected place, assuming corrupted packet. Packet: '{}'", playerID, Packet);
return std::nullopt;
}
@@ -79,6 +79,7 @@ static std::optional<VehiclePacket> ParseVehiclePacket(const std::string& Packet
return { { Data, PID, VID } }; // std::vector<char>(Data.begin(), Data.end())
}
}
beammp_debugf("Failed to parse packet from player {}", playerID);
return std::nullopt;
}

View File

@@ -111,7 +111,7 @@ int BeamMPServerMain(MainArguments Arguments) {
}
}
}
Application::Console().Internal().set_prompt("> ");
Application::SetSubsystemStatus("Main", Application::Status::Starting);