mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added error handling and debug printing to the medical extension
This commit is contained in:
parent
81f427ad82
commit
0c25f9d8fb
@ -39,6 +39,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
std::vector<std::string> arguments = parseExtensionInput(function);
|
std::vector<std::string> arguments = parseExtensionInput(function);
|
||||||
if (arguments.size() > 0)
|
if (arguments.size() > 0)
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
std::string command = arguments.at(0);
|
std::string command = arguments.at(0);
|
||||||
arguments.erase(arguments.begin());
|
arguments.erase(arguments.begin());
|
||||||
|
|
||||||
@ -61,6 +62,26 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
ace::medical::handleDamage::GetInstance().FinalizeDefinitions();
|
ace::medical::handleDamage::GetInstance().FinalizeDefinitions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (std::exception e) {
|
||||||
|
std::stringstream debugreturn;
|
||||||
|
debugreturn << "diag_log format['ACE3 ERROR - Medical Extension: Something went wrong. Input: '];";
|
||||||
|
int i = 0;
|
||||||
|
for (auto arg : arguments) {
|
||||||
|
debugreturn << "diag_log format[' arg " << i++ << ":" << arg << "'];";
|
||||||
|
}
|
||||||
|
debugreturn << "diag_log format['Exception: " << e.what() << "'];";
|
||||||
|
returnValue = debugreturn.str();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
std::stringstream debugreturn;
|
||||||
|
debugreturn << "diag_log format['ACE3 ERROR - Medical Extension: Something went wrong. Input: '];";
|
||||||
|
int i = 0;
|
||||||
|
for (auto arg : arguments) {
|
||||||
|
debugreturn << "diag_log format[' arg " << i++ << ":" << arg << "'];";
|
||||||
|
}
|
||||||
|
returnValue = debugreturn.str();
|
||||||
|
}
|
||||||
|
}
|
||||||
strncpy(output, returnValue.c_str(), outputSize);
|
strncpy(output, returnValue.c_str(), outputSize);
|
||||||
output[outputSize - 1] = '\0';
|
output[outputSize - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user