Skip to content

Commit 5f342aa

Browse files
committedOct 26, 2015
Remove some abort() calls
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
1 parent d69ef6a commit 5f342aa

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed
 

Diff for: ‎src/main.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ int main(int argc, char *argv[])
183183
#ifndef __ANDROID__
184184
// Run unit tests
185185
if (cmd_args.getFlag("run-unittests")) {
186-
run_tests();
187-
return 0;
186+
return run_tests();
188187
}
189188
#endif
190189

Diff for: ‎src/script/cpp_api/s_async.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,14 @@ void* AsyncWorkerThread::run()
244244

245245
std::string script = getServer()->getBuiltinLuaPath() + DIR_DELIM + "init.lua";
246246
if (!loadScript(script)) {
247-
errorstream << "execution of async base environment failed!"
248-
<< std::endl;
249-
abort();
247+
FATAL_ERROR("execution of async base environment failed!");
250248
}
251249

252250
int error_handler = PUSH_ERROR_HANDLER(L);
253251

254252
lua_getglobal(L, "core");
255253
if (lua_isnil(L, -1)) {
256-
errorstream << "Unable to find core within async environment!";
257-
abort();
254+
FATAL_ERROR("Unable to find core within async environment!");
258255
}
259256

260257
// Main loop
@@ -268,8 +265,7 @@ void* AsyncWorkerThread::run()
268265

269266
lua_getfield(L, -1, "job_processor");
270267
if (lua_isnil(L, -1)) {
271-
errorstream << "Unable to get async job processor!" << std::endl;
272-
abort();
268+
FATAL_ERROR("Unable to get async job processor!");
273269
}
274270

275271
luaL_checktype(L, -1, LUA_TFUNCTION);

Diff for: ‎src/unittest/test.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void TestGameDef::defineSomeNodes()
215215
//// run_tests
216216
////
217217

218-
void run_tests()
218+
bool run_tests()
219219
{
220220
DSTACK(FUNCTION_NAME);
221221

@@ -253,8 +253,7 @@ void run_tests()
253253
<< "++++++++++++++++++++++++++++++++++++++++"
254254
<< "++++++++++++++++++++++++++++++++++++++++" << std::endl;
255255

256-
if (num_modules_failed)
257-
abort();
256+
return num_modules_failed;
258257
}
259258

260259
////

Diff for: ‎src/unittest/test.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,6 @@ extern content_t t_CONTENT_WATER;
142142
extern content_t t_CONTENT_LAVA;
143143
extern content_t t_CONTENT_BRICK;
144144

145-
void run_tests();
145+
bool run_tests();
146146

147147
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.