Skip to content

Commit 5ab90c7

Browse files
committed
fix: put useful informations in case of unexpected exception
1 parent 49eece5 commit 5ab90c7

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/services.h

+14-13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#endif
2828

2929
#include <mapbox/variant.hpp>
30+
#include <boost/exception/diagnostic_information.hpp>
3031
#include "mlservice.h"
3132
#include "apidata.h"
3233
#include "inputconnectorstrategy.h"
@@ -417,7 +418,8 @@ namespace dd
417418
}
418419
catch (...)
419420
{
420-
llog->error("service creation call failed");
421+
llog->error("service creation call failed: {}",
422+
boost::current_exception_diagnostic_information());
421423
throw;
422424
}
423425
}
@@ -455,7 +457,9 @@ namespace dd
455457
}
456458
catch (...)
457459
{
458-
llog->error("delete service call failed");
460+
llog->error(
461+
"delete service call failed: {}",
462+
boost::current_exception_diagnostic_information());
459463
throw;
460464
}
461465
}
@@ -529,7 +533,8 @@ namespace dd
529533
}
530534
catch (...)
531535
{
532-
llog->error("training call failed");
536+
llog->error("training call failed: {}",
537+
boost::current_exception_diagnostic_information());
533538
throw;
534539
}
535540

@@ -568,7 +573,8 @@ namespace dd
568573
catch (...)
569574
{
570575
auto llog = spdlog::get(sname);
571-
llog->error("training status call failed");
576+
llog->error("training status call failed: {}",
577+
boost::current_exception_diagnostic_information());
572578
throw;
573579
}
574580
}
@@ -590,7 +596,8 @@ namespace dd
590596
catch (...)
591597
{
592598
auto llog = spdlog::get(sname);
593-
llog->error("training delete call failed");
599+
llog->error("training delete call failed: {}",
600+
boost::current_exception_diagnostic_information());
594601
throw;
595602
}
596603
}
@@ -635,16 +642,10 @@ namespace dd
635642
llog->error("mllib lock error: {}", e.what());
636643
throw;
637644
}
638-
catch (const std::exception &e)
639-
{
640-
// catch anything thrown within try block that derives from
641-
// std::exception
642-
llog->error("other error: {}", e.what());
643-
throw;
644-
}
645645
catch (...)
646646
{
647-
llog->error("prediction call failed");
647+
llog->error("prediction call failed: {}",
648+
boost::current_exception_diagnostic_information());
648649
throw;
649650
}
650651
std::chrono::time_point<std::chrono::system_clock> tstop

0 commit comments

Comments
 (0)