修复编译错误

This commit is contained in:
xiongziliang 2019-05-21 09:26:24 +08:00
parent 056ce72182
commit 7431a05811

View File

@ -7,7 +7,9 @@
#include "Util/logger.h" #include "Util/logger.h"
#include "Util/onceToken.h" #include "Util/onceToken.h"
#include "Util/NoticeCenter.h" #include "Util/NoticeCenter.h"
#ifdef ENABLE_MYSQL
#include "Util/SqlPool.h" #include "Util/SqlPool.h"
#endif //ENABLE_MYSQL
#include "Common/config.h" #include "Common/config.h"
#include "Common/MediaSource.h" #include "Common/MediaSource.h"
#include "Http/HttpRequester.h" #include "Http/HttpRequester.h"
@ -161,12 +163,16 @@ static inline void addHttpListener(){
val["code"] = ex.code(); val["code"] = ex.code();
val["msg"] = ex.what(); val["msg"] = ex.what();
invoker("200 OK", headerOut, val.toStyledString()); invoker("200 OK", headerOut, val.toStyledString());
} catch(SqlException &ex){ }
#ifdef ENABLE_MYSQL
catch(SqlException &ex){
val["code"] = API::SqlFailed; val["code"] = API::SqlFailed;
val["msg"] = StrPrinter << "操作数据库失败:" << ex.what() << ":" << ex.getSql(); val["msg"] = StrPrinter << "操作数据库失败:" << ex.what() << ":" << ex.getSql();
WarnL << ex.what() << ":" << ex.getSql(); WarnL << ex.what() << ":" << ex.getSql();
invoker("200 OK", headerOut, val.toStyledString()); invoker("200 OK", headerOut, val.toStyledString());
} catch (std::exception &ex) { }
#endif// ENABLE_MYSQL
catch (std::exception &ex) {
val["code"] = API::OtherFailed; val["code"] = API::OtherFailed;
val["msg"] = ex.what(); val["msg"] = ex.what();
invoker("200 OK", headerOut, val.toStyledString()); invoker("200 OK", headerOut, val.toStyledString());