Request am40967 (logging set_fail_state)
This commit is contained in:
parent
43bd5fc732
commit
e2932fb61a
@ -3719,6 +3719,11 @@ static cell AMX_NATIVE_CALL set_fail_state(AMX *amx, cell *params)
|
|||||||
pPlugin->setStatus(ps_error);
|
pPlugin->setStatus(ps_error);
|
||||||
pPlugin->setError(str);
|
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
|
//plugin dies once amx_Exec concludes
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +622,12 @@ void Debugger::FmtGenericMsg(AMX *amx, int error, char buffer[], size_t maxLengt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_snprintf(buffer, maxLength, "Run time error %d (plugin \"%s\") - debug not enabled!", error, filename);
|
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)
|
void Debugger::GenericMessage(AMX *amx, int err)
|
||||||
|
@ -1537,7 +1537,9 @@ extern "C" void LogError(AMX *amx, int err, const char *fmt, ...)
|
|||||||
#if defined BINLOG_ENABLED
|
#if defined BINLOG_ENABLED
|
||||||
CPluginMngr::CPlugin *pl = g_plugins.findPluginFast(amx);
|
CPluginMngr::CPlugin *pl = g_plugins.findPluginFast(amx);
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
g_BinLog.WriteOp(BinLog_NativeError, pl->getId(), err, msg_buffer);
|
g_BinLog.WriteOp(BinLog_NativeError, pl->getId(), err, msg_buffer);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//give the plugin first chance to handle any sort of error
|
//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 (pHandler->InNativeFilter())
|
||||||
{
|
{
|
||||||
if (pDebugger)
|
if (pDebugger)
|
||||||
|
{
|
||||||
pDebugger->EndExec();
|
pDebugger->EndExec();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pHandler)
|
if (pHandler)
|
||||||
{
|
{
|
||||||
if (pHandler->IsHandling())
|
if (pHandler->IsHandling())
|
||||||
{
|
{
|
||||||
if (fmt != NULL)
|
if (fmt != NULL)
|
||||||
|
{
|
||||||
pHandler->SetErrorMsg(msg_buffer);
|
pHandler->SetErrorMsg(msg_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1569,10 +1576,15 @@ extern "C" void LogError(AMX *amx, int err, const char *fmt, ...)
|
|||||||
if (!pDebugger)
|
if (!pDebugger)
|
||||||
{
|
{
|
||||||
if (fmt)
|
if (fmt)
|
||||||
|
{
|
||||||
AMXXLOG_Error("%s", msg_buffer);
|
AMXXLOG_Error("%s", msg_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
Debugger::GenericMessage(amx, err);
|
Debugger::GenericMessage(amx, err);
|
||||||
AMXXLOG_Error("[AMXX] To enable debug mode, add \"debug\" after the plugin name in plugins.ini (without quotes).");
|
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
|
//destroy original error code so the original is not displayed again
|
||||||
} else {
|
} else {
|
||||||
pDebugger->SetTracedError(err);
|
pDebugger->SetTracedError(err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user