trainings/CreatingReliableSoftwareCpp/Presentation/exercises/exception/README.md

548 B

Linux compilation

> mkdir build
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
> make

Exercise 1

  • Create an exception class Exception which inherits from std::exceptionand two classesParserExceptionandReaderExceptionwhich inherit form classException`.
  • Rewrite a code to ParserException in the method parse and ReaderException in the method read.
  • Try to catch errors in main and print them
  • Rewrite a code once again and return nullopt when an error occurs instead of throwing an exception