catch all exceptions in all tutorials and examples

This commit is contained in:
Andreas Lauser 2013-09-02 17:35:33 +02:00
parent c4c771e39b
commit 5d435d396c
10 changed files with 51 additions and 2 deletions

View File

@ -92,6 +92,7 @@ namespace
// ----------------- Main program ----------------- // ----------------- Main program -----------------
int int
main(int argc, char** argv) main(int argc, char** argv)
try
{ {
using namespace Opm; using namespace Opm;
@ -297,3 +298,7 @@ main(int argc, char** argv)
<< "\n Pressure time: " << ptime << "\n Pressure time: " << ptime
<< "\n Transport time: " << ttime << std::endl; << "\n Transport time: " << ttime << std::endl;
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}

View File

@ -73,6 +73,7 @@ namespace
// ----------------- Main program ----------------- // ----------------- Main program -----------------
int int
main(int argc, char** argv) main(int argc, char** argv)
try
{ {
using namespace Opm; using namespace Opm;
@ -209,3 +210,7 @@ main(int argc, char** argv)
} }
} }
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}

View File

@ -250,6 +250,7 @@ static bool parseFile(const std::string& inputFile, std::string& outputFile, con
int int
main(int argc, char** argv) main(int argc, char** argv)
try
{ {
if (argc != 2) if (argc != 2)
OPM_THROW(std::runtime_error, "Need the name of ECLIPSE file on command line"); OPM_THROW(std::runtime_error, "Need the name of ECLIPSE file on command line");
@ -258,3 +259,7 @@ main(int argc, char** argv)
parseFile(argv[1] , outputFile); parseFile(argv[1] , outputFile);
} }
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}

View File

@ -70,6 +70,7 @@ namespace
// ----------------- Main program ----------------- // ----------------- Main program -----------------
int int
main(int argc, char** argv) main(int argc, char** argv)
try
{ {
using namespace Opm; using namespace Opm;
@ -282,3 +283,7 @@ main(int argc, char** argv)
} }
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}

View File

@ -71,6 +71,7 @@ namespace
// ----------------- Main program ----------------- // ----------------- Main program -----------------
int int
main(int argc, char** argv) main(int argc, char** argv)
try
{ {
using namespace Opm; using namespace Opm;
@ -300,3 +301,7 @@ main(int argc, char** argv)
} }
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}

View File

@ -20,8 +20,8 @@
#include <opm/core/props/rock/RockCompressibility.hpp> #include <opm/core/props/rock/RockCompressibility.hpp>
int main(int argc, char** argv) int main(int argc, char** argv)
try
{ {
using namespace Opm::parameter; using namespace Opm::parameter;
using namespace Opm; using namespace Opm;
ParameterGroup parameters(argc, argv, false); ParameterGroup parameters(argc, argv, false);
@ -130,4 +130,7 @@ int main(int argc, char** argv)
#endif #endif
return 0; return 0;
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}

View File

@ -45,6 +45,7 @@
// ----------------- Main program ----------------- // ----------------- Main program -----------------
int main() int main()
try
{ {
/// \page tutorial1 /// \page tutorial1
/// We set the number of blocks in each direction. /// We set the number of blocks in each direction.
@ -102,6 +103,10 @@ int main()
/// \internal [write vtk] /// \internal [write vtk]
/// \endinternal /// \endinternal
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
/// \page tutorial1 /// \page tutorial1
/// We read the vtu output file in \a Paraview and obtain the following grid. /// We read the vtu output file in \a Paraview and obtain the following grid.

View File

@ -50,6 +50,7 @@
/// ///
int main() int main()
try
{ {
/// \page tutorial2 /// \page tutorial2
@ -195,6 +196,10 @@ int main()
/// \internal [write output] /// \internal [write output]
/// \endinternal /// \endinternal
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
/// \page tutorial2 /// \page tutorial2
/// We read the vtu output file in \a Paraview and obtain the following pressure /// We read the vtu output file in \a Paraview and obtain the following pressure

View File

@ -93,6 +93,7 @@
/// \snippet tutorial3.cpp main /// \snippet tutorial3.cpp main
/// \internal [main] /// \internal [main]
int main () int main ()
try
{ {
/// \internal [main] /// \internal [main]
/// \endinternal /// \endinternal
@ -316,6 +317,10 @@ int main ()
Opm::writeVtkData(grid, dm, vtkfile); Opm::writeVtkData(grid, dm, vtkfile);
} }
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
/// \internal [write output] /// \internal [write output]
/// \endinternal /// \endinternal

View File

@ -52,6 +52,7 @@
/// \snippet tutorial4.cpp main /// \snippet tutorial4.cpp main
/// \internal[main] /// \internal[main]
int main () int main ()
try
{ {
/// \internal[main] /// \internal[main]
/// \endinternal /// \endinternal
@ -436,6 +437,11 @@ int main ()
destroy_wells(wells); destroy_wells(wells);
} }
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
/// \internal[write output] /// \internal[write output]
/// \endinternal /// \endinternal