MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / printLastException

Function printLastException

src/openms/source/CONCEPT/ClassTest.cpp:672–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670
671
672 void printLastException(std::ostream& out)
673 {
674 std::exception_ptr ex = std::current_exception();
675 try
676 {
677 std::rethrow_exception(ex);
678 }
679 catch (::OpenMS::Exception::BaseException& e)
680 {
681 TEST::this_test = false;
682 TEST::test = false;
683 TEST::all_tests = false;
684 {
685 TEST::initialNewline();
686 out << "Error: Caught unexpected OpenMS exception of type '" << e.getName() << "'";
687 if ((e.getLine() > 0) && std::strcmp(e.getFile(), ""))
688 {
689 out << " thrown in line " << e.getLine() << " of file '" << e.getFile() << "' in function '" << e.getFunction() << "'";
690 }
691 out << " - Message: " << e.what() << std::endl;
692 }
693 } /* catch std:: exceptions */
694 catch (std::exception& e)
695 {
696 TEST::this_test = false;
697 TEST::test = false;
698 TEST::all_tests = false;
699 {
700 TEST::initialNewline();
701 out << "Error: Caught unexpected std::exception\n";
702 out << " - Message: " << e.what() << std::endl;
703 }
704 } /* catch all other exceptions */
705 catch (...)
706 {
707 TEST::this_test = false;
708 TEST::test = false;
709 TEST::all_tests = false;
710 {
711 TEST::initialNewline();
712 out << "Error: Caught unidentified and unexpected exception - No message." << std::endl;
713 }
714 }
715 }
716
717 int endTestPostProcess(std::ostream& out)
718 {

Callers

nothing calls this directly

Calls 5

initialNewlineFunction · 0.85
getLineMethod · 0.80
getFileMethod · 0.80
getFunctionMethod · 0.80
getNameMethod · 0.45

Tested by

no test coverage detected