Request am40967 (logging set_fail_state)
This commit is contained in:
		| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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); | ||||
| 		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 | ||||
| 	} else { | ||||
| 		pDebugger->SetTracedError(err); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user