Request am40967 (logging set_fail_state)

This commit is contained in:
David Anderson 2006-08-18 19:02:37 +00:00
parent 43bd5fc732
commit e2932fb61a
3 changed files with 24 additions and 2 deletions

View File

@ -3719,6 +3719,11 @@ static cell AMX_NATIVE_CALL set_fail_state(AMX *amx, cell *params)
pPlugin->setStatus(ps_error);
pPlugin->setError(str);
AMXXLOG_Error("[AMXX] Plugin (\"%s\") is setting itself as failed.", pPlugin->getName());
AMXXLOG_Error("[AMXX] Plugin says: %s", str);
LogError(amx, AMX_ERR_EXIT, NULL);
//plugin dies once amx_Exec concludes
return 0;
}

View File

@ -622,8 +622,13 @@ void Debugger::FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLengt
}
}
if (error == AMX_ERR_EXIT)
{
_snprintf(buffer, maxLength, "Run time error %d (plugin \"%s\") - %s", error, filename, GenericError(AMX_ERR_EXIT));
} else {
_snprintf(buffer, maxLength, "Run time error %d (plugin \"%s\") - debug not enabled!", error, filename);
}
}
void Debugger::GenericMessage(AMX *amx, int err)
{

View File

@ -1537,7 +1537,9 @@ extern "C" void LogError(AMX *amx, int err, const char *fmt, ...)
#if defined BINLOG_ENABLED
CPluginMngr::CPlugin *pl = g_plugins.findPluginFast(amx);
if (pl)
{
g_BinLog.WriteOp(BinLog_NativeError, pl->getId(), err, msg_buffer);
}
#endif
//give the plugin first chance to handle any sort of error
@ -1546,14 +1548,19 @@ extern "C" void LogError(AMX *amx, int err, const char *fmt, ...)
if (pHandler->InNativeFilter())
{
if (pDebugger)
{
pDebugger->EndExec();
}
} else {
if (pHandler)
{
if (pHandler->IsHandling())
{
if (fmt != NULL)
{
pHandler->SetErrorMsg(msg_buffer);
}
return;
}
@ -1569,10 +1576,15 @@ extern "C" void LogError(AMX *amx, int err, const char *fmt, ...)
if (!pDebugger)
{
if (fmt)
{
AMXXLOG_Error("%s", msg_buffer);
}
Debugger::GenericMessage(amx, err);
if (err != AMX_ERR_EXIT)
{
AMXXLOG_Error("[AMXX] To enable debug mode, add \"debug\" after the plugin name in plugins.ini (without quotes).");
}
//destroy original error code so the original is not displayed again
} else {
pDebugger->SetTracedError(err);