mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Fix server crashing on Lua errors
Previously, the server called FATAL_ERROR when a Lua error occured. This caused a (mostly useless) core dump. The server now simply throws an exception, which is caught and printed before exiting with a non-zero return value. This also fixes a number of instances where errors were logged multiple times.
This commit is contained in:
parent
b872df6ef6
commit
9269a0ecc7
10 changed files with 58 additions and 80 deletions
18
src/mods.h
18
src/mods.h
|
@ -26,29 +26,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <exception>
|
||||
#include "json/json.h"
|
||||
#include "config.h"
|
||||
|
||||
#define MODNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyz0123456789_"
|
||||
|
||||
class ModError : public std::exception
|
||||
{
|
||||
public:
|
||||
ModError(const std::string &s)
|
||||
{
|
||||
m_s = "ModError: ";
|
||||
m_s += s;
|
||||
}
|
||||
virtual ~ModError() throw()
|
||||
{}
|
||||
virtual const char * what() const throw()
|
||||
{
|
||||
return m_s.c_str();
|
||||
}
|
||||
std::string m_s;
|
||||
};
|
||||
|
||||
struct ModSpec
|
||||
{
|
||||
std::string name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue