提交 0bab0b5e 编写于 作者: G groot 提交者: jinhai

add more error handling


Former-commit-id: 21d14f9541d81e2a30a59c4501835d5f549c5360
上级 f3195276
...@@ -40,12 +40,16 @@ DBWrapper::DBWrapper() { ...@@ -40,12 +40,16 @@ DBWrapper::DBWrapper() {
opt.meta.archive_conf.SetCriterias(criterial); opt.meta.archive_conf.SetCriterias(criterial);
//create db root folder //create db root folder
CommonUtil::CreateDirectory(opt.meta.path); ServerError err = CommonUtil::CreateDirectory(opt.meta.path);
if(err != SERVER_SUCCESS) {
std::cout << "ERROR! Failed to create database root path: " << opt.meta.path << std::endl;
kill(0, SIGUSR1);
}
zilliz::milvus::engine::DB::Open(opt, &db_); zilliz::milvus::engine::DB::Open(opt, &db_);
if(db_ == nullptr) { if(db_ == nullptr) {
SERVER_LOG_ERROR << "Failed to open db. Provided database uri = " << opt.meta.backend_uri; std::cout << "ERROR! Failed to open database" << std::endl;
throw ServerException(SERVER_NULL_POINTER, "Failed to open db"); kill(0, SIGUSR1);
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <thrift/concurrency/PosixThreadFactory.h> #include <thrift/concurrency/PosixThreadFactory.h>
#include <thread> #include <thread>
#include <iostream>
namespace zilliz { namespace zilliz {
namespace milvus { namespace milvus {
...@@ -93,7 +94,8 @@ MilvusServer::StartService() { ...@@ -93,7 +94,8 @@ MilvusServer::StartService() {
return; return;
} }
} catch (apache::thrift::TException& ex) { } catch (apache::thrift::TException& ex) {
SERVER_LOG_ERROR << "Server encounter exception: " << ex.what(); std::cout << "ERROR! " << ex.what() << std::endl;
kill(0, SIGUSR1);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册