Commit 819b6c39 authored by Mathis Kelm's avatar Mathis Kelm Committed by Timo Koch
Browse files

[cleanup][test] Remove try/catch exception handling from all tests

parent 451d83fe
......@@ -17,7 +17,7 @@
#include <dumux/discretization/box/fvgridgeometry.hh>
#include <dumux/io/grid/gridmanager_yasp.hh>
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
// maybe initialize mpi
Dune::MPIHelper::instance(argc, argv);
......@@ -112,10 +112,3 @@ int main (int argc, char *argv[]) try
std::cout << "All tests passed!" << std::endl;
return 0;
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (const Dune::Exception& e) {
std::cout << e << std::endl;
return 1;
}
......@@ -33,7 +33,7 @@ private:
} // end namespace Dumux
int main(int argc, char* argv[]) try
int main(int argc, char* argv[])
{
using namespace Dumux;
......@@ -83,8 +83,3 @@ int main(int argc, char* argv[]) try
return 0;
}
catch (const Dune::Exception& e)
{
std::cout << e << std::endl;
return 1;
}
......@@ -55,7 +55,7 @@ void checkTableInterpolation(Scalar ip, Scalar expected, const Table& table, Sca
} // end namespace Test
int main() try
int main()
{
//! Declare Vectors (FieldVector and DynamicVector)
Dune::FieldVector<double, 3> v1({1.0, 2.0, 3.0});
......@@ -215,7 +215,3 @@ int main() try
}
}
catch (Dune::Exception& e) {
std::cerr << e << std::endl;
return 1;
}
......@@ -6,7 +6,7 @@
#include <dumux/common/parameters.hh>
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
......@@ -71,22 +71,3 @@ int main (int argc, char *argv[]) try
return 0;
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (const Dune::RangeError &e) {
std::cout << e << std::endl;
return 1;
}
catch (const Dune::Exception& e) {
std::cout << e << std::endl;
return 1;
}
catch (const std::exception& e) {
std::cout << e.what() << std::endl;
return 1;
}
catch (...) {
std::cout << "Unknown exception!" << std::endl;
return 1;
}
......@@ -81,7 +81,7 @@ struct UseTpfaFlux<TypeTag, TTag::CCTpfaDisc> { static constexpr bool value = tr
} // end namespace Dumux
//! the main function
int main(int argc, char* argv[]) try
int main(int argc, char* argv[])
{
using namespace Dumux;
using namespace Properties;
......@@ -120,17 +120,4 @@ int main(int argc, char* argv[]) try
std::cout << "All tests passed!" << std::endl;
return 0;
}
// error handler
catch (const Dune::Exception& e)
{
std::cerr << "Dune exception thrown: " << e << " --> Abort!" << std::endl;
return 1;
}
catch (...)
{
std::cerr << "Unknown exception thrown --> Abort!" << std::endl;
return 2;
}
// find . -type f -not -path '*common/properties*' -not -path '*/sequential/*' -not -name 'test_propertysystem*.cc' -name '*.[ch][ch]' -exec sed -i 's/SET_BOOL_PROP[ ]*(\([^,]*\),[ ]*\([^,]*\),[ ]*\([^)]*\))/template<class TypeTag>\nstruct \2<TypeTag, TTag::\1> { static constexpr bool value = \3; }/g' {} \;
......@@ -71,7 +71,7 @@ void runTest()
} // end namespace Dumux
int main(int argc, char* argv[]) try
int main(int argc, char* argv[])
{
using namespace Dumux;
......@@ -80,13 +80,3 @@ int main(int argc, char* argv[]) try
return 0;
}
catch (const Dune::Exception& e)
{
std::cout << e << std::endl;
return 1;
}
catch (...)
{
std::cout << "Unknown exception thrown!" << std::endl;
return 1;
}
......@@ -12,7 +12,7 @@
#include <dumux/common/timeloop.hh>
int main(int argc, char* argv[]) try
int main(int argc, char* argv[])
{
const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
......@@ -199,10 +199,3 @@ int main(int argc, char* argv[]) try
return 0;
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (const Dune::Exception& e) {
std::cout << e << std::endl;
return 1;
}
......@@ -46,7 +46,7 @@ public:
} // end namespace Dumux
#endif
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
......@@ -115,11 +115,3 @@ int main (int argc, char *argv[]) try
<< " but the number of boundary scvfs is " << boundaryCount);
}
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception &e) {
std::cout << e << std::endl;
return 1;
}
......@@ -46,7 +46,7 @@ public:
} // end namespace Dumux
#endif
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
......@@ -116,11 +116,3 @@ int main (int argc, char *argv[]) try
<< " but the number of boundary scvfs is " << boundaryCount);
}
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception &e) {
std::cout << e << std::endl;
return 1;
}
......@@ -106,7 +106,7 @@ std::string elementTypeName(const Dune::FieldVector<double, 2>& center)
} // end namespace Dumux
#endif
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
using namespace Dumux::Test;
......@@ -379,11 +379,3 @@ int main (int argc, char *argv[]) try
DUNE_THROW(Dune::InvalidStateException, "Element center position could not be interpreted.");
}
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception& e) {
std::cout << e << std::endl;
return 1;
}
......@@ -49,7 +49,7 @@
#include <dumux/discretization/projection/projector.hh>
#include <dumux/multidomain/glue.hh>
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
// maybe initialize mpi
Dune::MPIHelper::instance(argc, argv);
......@@ -166,11 +166,3 @@ int main (int argc, char *argv[]) try
return 0;
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception &e) {
std::cout << e << std::endl;
return 1;
}
......@@ -87,7 +87,7 @@ void runTest(const GG& gg, const double refVolume, const double refSurface)
} // end namespace Dumux
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
......@@ -211,11 +211,3 @@ int main (int argc, char *argv[]) try
return 0;
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception &e) {
std::cout << e << std::endl;
return 1;
}
......@@ -56,7 +56,7 @@ public:
} // end namespace Dumux
#endif
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
......@@ -191,11 +191,3 @@ int main (int argc, char *argv[]) try
}
}
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception &e) {
std::cout << e << std::endl;
return 1;
}
......@@ -92,7 +92,7 @@ struct TestFVGGTraits : public DefaultMapperTraits<GridView>
} // end namespace Dumux
#endif
int main (int argc, char *argv[]) try
int main (int argc, char *argv[])
{
using namespace Dumux;
......@@ -166,11 +166,3 @@ int main (int argc, char *argv[]) try
<< " but the number of boundary scvfs is " << boundaryCount);
}
}
// //////////////////////////////////
// Error handler
// /////////////////////////////////
catch (Dune::Exception& e) {
std::cout << e << std::endl;
return 1;
}
......@@ -126,7 +126,7 @@ using FickDC = Dumux::FickianDiffusionCoefficients<int, numComponents, numPhases
template<int numComponents, int numPhases>
using MSDC = Dumux::MaxwellStefanDiffusionCoefficients<int, numComponents, numPhases>;
int main(int argc, char* argv[]) try
int main(int argc, char* argv[])
{
testFickianContainer<FickDC<1, 5>, 1, 5>();
testFickianContainer<FickDC<2, 2>, 2, 2>();
......@@ -144,8 +144,3 @@ int main(int argc, char* argv[]) try
return 0;
}
catch (const Dune::Exception& e)
{
std::cout << e << std::endl;
return 1;
}
......@@ -32,7 +32,6 @@
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/dgfparser/dgfexception.hh>
#include <dune/grid/io/file/vtk.hh>
#include <dumux/assembly/staggeredfvassembler.hh>
......@@ -103,7 +102,7 @@ auto createAnalyticalSolution(const Scalar time, const Problem& problem)
return std::make_tuple(analyticalPressure, analyticalVelocity, analyticalVelocityOnFace);
}
int main(int argc, char** argv) try
int main(int argc, char** argv)
{
using namespace Dumux;
......@@ -249,27 +248,3 @@ int main(int argc, char** argv) try
return 0;
} // end main
catch (Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
catch (...)
{
std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl;
return 4;
}
......@@ -29,7 +29,6 @@
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/dgfparser/dgfexception.hh>
#include <dune/grid/io/file/vtk.hh>
#include <dune/istl/io.hh>
......@@ -45,7 +44,7 @@
#include "problem.hh"
int main(int argc, char** argv) try
int main(int argc, char** argv)
{
using namespace Dumux;
......@@ -142,27 +141,3 @@ int main(int argc, char** argv) try
return 0;
} // end main
catch (Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
catch (...)
{
std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl;
return 4;
}
......@@ -29,7 +29,6 @@
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/dgfparser/dgfexception.hh>
#include <dune/grid/io/file/vtk.hh>
#include <dune/istl/io.hh>
......@@ -46,7 +45,7 @@
#include "problem.hh"
int main(int argc, char** argv) try
int main(int argc, char** argv)
{
using namespace Dumux;
......@@ -270,27 +269,3 @@ int main(int argc, char** argv) try
return 0;
} // end main
catch (Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
catch (...)
{
std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl;
return 4;
}
......@@ -29,7 +29,6 @@
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/timer.hh>
#include <dune/grid/io/file/dgfparser/dgfexception.hh>
#include <dune/grid/io/file/vtk.hh>
#include <dune/istl/io.hh>
......@@ -47,7 +46,7 @@
#include "problem.hh"
int main(int argc, char** argv) try
int main(int argc, char** argv)
{
using namespace Dumux;
......@@ -259,27 +258,3 @@ flux.addSurface("middle", p0middle, p1middle);
return 0;
} // end main
catch (Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
catch (...)
{
std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl;
return 4;
}
......@@ -67,7 +67,7 @@ void printL2Error(const Problem& problem, const SolutionVector& x, const GridGeo
logFile.close();
}
int main(int argc, char** argv) try
int main(int argc, char** argv)
{
using namespace Dumux;
......@@ -137,22 +137,3 @@ int main(int argc, char** argv) try
return 0;
} // end main
catch (const Dumux::ParameterException &e)
{
std::cerr << std::endl << e << " ---> Abort!" << std::endl;
return 1;
}
catch (const Dune::DGFException & e)
{
std::cerr << "DGF exception thrown (" << e <<
"). Most likely, the DGF file name is wrong "
"or the DGF file is corrupted, "
"e.g. missing hash at end of file or wrong number (dimensions) of entries."
<< " ---> Abort!" << std::endl;
return 2;
}
catch (const Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl;
return 3;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment