Skip to content

Commit

Permalink
Remove some abort() calls
Browse files Browse the repository at this point in the history
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
  • Loading branch information
est31 committed Oct 26, 2015
1 parent d69ef6a commit 5f342aa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/main.cpp
Expand Up @@ -183,8 +183,7 @@ int main(int argc, char *argv[])
#ifndef __ANDROID__
// Run unit tests
if (cmd_args.getFlag("run-unittests")) {
run_tests();
return 0;
return run_tests();
}
#endif

Expand Down
10 changes: 3 additions & 7 deletions src/script/cpp_api/s_async.cpp
Expand Up @@ -244,17 +244,14 @@ void* AsyncWorkerThread::run()

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

int error_handler = PUSH_ERROR_HANDLER(L);

lua_getglobal(L, "core");
if (lua_isnil(L, -1)) {
errorstream << "Unable to find core within async environment!";
abort();
FATAL_ERROR("Unable to find core within async environment!");
}

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

lua_getfield(L, -1, "job_processor");
if (lua_isnil(L, -1)) {
errorstream << "Unable to get async job processor!" << std::endl;
abort();
FATAL_ERROR("Unable to get async job processor!");
}

luaL_checktype(L, -1, LUA_TFUNCTION);
Expand Down
5 changes: 2 additions & 3 deletions src/unittest/test.cpp
Expand Up @@ -215,7 +215,7 @@ void TestGameDef::defineSomeNodes()
//// run_tests
////

void run_tests()
bool run_tests()
{
DSTACK(FUNCTION_NAME);

Expand Down Expand Up @@ -253,8 +253,7 @@ void run_tests()
<< "++++++++++++++++++++++++++++++++++++++++"
<< "++++++++++++++++++++++++++++++++++++++++" << std::endl;

if (num_modules_failed)
abort();
return num_modules_failed;
}

////
Expand Down
2 changes: 1 addition & 1 deletion src/unittest/test.h
Expand Up @@ -142,6 +142,6 @@ extern content_t t_CONTENT_WATER;
extern content_t t_CONTENT_LAVA;
extern content_t t_CONTENT_BRICK;

void run_tests();
bool run_tests();

#endif

0 comments on commit 5f342aa

Please sign in to comment.