Skip to content

Commit a3389a3

Browse files
committed
Added output of messages with exceptions.
1 parent 0e8c8dd commit a3389a3

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/server/Server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ namespace HttpServer
313313
app->application_final(root.data() );
314314
}
315315
}
316-
catch (std::exception &exc) {
316+
catch (const std::exception &exc) {
317317
std::cout << "Warning: an exception was thrown when the application '"
318318
<< app->server_module << "' was finishes: " << exc.what() << std::endl;
319319
}
@@ -460,7 +460,7 @@ namespace HttpServer
460460
app->application_init(root.data() );
461461
}
462462
}
463-
catch (std::exception &exc) {
463+
catch (const std::exception &exc) {
464464
std::cout << "Warning: an exception was thrown when the application '" << module_name << "' was initialized: " << exc.what() << std::endl;
465465
}
466466
}

src/server/ServerSettings.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ namespace HttpServer
3434

3535
for (auto &app : applications)
3636
{
37-
try
38-
{
37+
try {
3938
if (app->application_final) {
4039
const std::string root = app->root_dir;
4140
app->application_final(root.data() );
4241
}
4342
}
44-
catch (std::exception &exc)
45-
{
43+
catch (const std::exception &exc) {
4644
std::cout << "Warning: an exception was thrown when the application '" << app->server_module << "' was finishes: " << exc.what() << std::endl;
4745
}
4846

src/server/config/ConfigParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ namespace HttpServer
283283
success = app_init(root.data() );
284284
}
285285
}
286-
catch (std::exception &exc) {
286+
catch (const std::exception &exc) {
287287
std::cout << "Warning: an exception was thrown when the application '" << it_module->second << "' was initialized: " << exc.what() << std::endl;
288288
success = false;
289289
}

src/server/protocol/ServerProtocol.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "ServerProtocol.h"
33
#include "../../utils/Utils.h"
44

5+
#include <iostream>
6+
57
namespace HttpServer
68
{
79
ServerProtocol::ServerProtocol(
@@ -167,8 +169,9 @@ namespace HttpServer
167169
// Launch application
168170
req.app_exit_code = appSets.application_call(&request, &response);
169171
}
170-
catch (std::exception &exc) {
171-
// TODO: exception output
172+
catch (const std::exception &exc) {
173+
// Exception output
174+
std::cout << "Exception when application_call: " << exc.what() << std::endl;
172175
}
173176

174177
if (response.response_data && response.data_size)
@@ -181,8 +184,9 @@ namespace HttpServer
181184
try {
182185
appSets.application_clear(response.response_data, response.data_size);
183186
}
184-
catch (std::exception &exc) {
185-
// TODO: exception output
187+
catch (const std::exception &exc) {
188+
// Exception output
189+
std::cout << "Exception when application_clear: " << exc.what() << std::endl;
186190
}
187191
}
188192
}

0 commit comments

Comments
 (0)