From b8b51e7525d04fc537d3510dcde77df088cc060b Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 18 Dec 2022 14:28:38 +0100 Subject: [PATCH] Use error macros in HTTPSessionManager and HTTPSessionManagerDB. --- modules/web/database/http_session_manager_db.cpp | 6 +----- modules/web/http/http_session_manager.cpp | 10 ++-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/modules/web/database/http_session_manager_db.cpp b/modules/web/database/http_session_manager_db.cpp index 14e24b455..900d095eb 100644 --- a/modules/web/database/http_session_manager_db.cpp +++ b/modules/web/database/http_session_manager_db.cpp @@ -185,11 +185,7 @@ void HTTPSessionManagerDB::load_sessions() { } } - if (!s.is_valid()) { - printf("Error: HTTPSessionManagerDB::load_sessions(): %d sid doesn't exists!\n", session_db_id); - - continue; - } + ERR_CONTINUE_MSG(!s.is_valid(), vformat("Error: HTTPSessionManagerDB::load_sessions(): %d sid doesn't exists!", session_db_id)); String key = r->get_cell(1); String vb64 = r->get_cell(2); diff --git a/modules/web/http/http_session_manager.cpp b/modules/web/http/http_session_manager.cpp index 6a3cb9c16..7c480c9f2 100644 --- a/modules/web/http/http_session_manager.cpp +++ b/modules/web/http/http_session_manager.cpp @@ -14,10 +14,7 @@ #include "web_server_request.h" void HTTPSessionManager::add_session(Ref session) { - if (!session.is_valid()) { - printf("HTTPSessionManager::add_session: ERROR, session is null!\n"); - return; - } + ERR_FAIL_COND(!session.is_valid()); _mutex.lock(); @@ -28,10 +25,7 @@ void HTTPSessionManager::add_session(Ref session) { } void HTTPSessionManager::remove_session(Ref session) { - if (!session.is_valid()) { - printf("HTTPSessionManager::remove_session: ERROR, session is null!\n"); - return; - } + ERR_FAIL_COND(!session.is_valid()); _mutex.lock();