fork(3) download
  1. #include <iostream>
  2. #include <stdexcept>
  3.  
  4. class read_failure : std::runtime_error
  5. {
  6. public:
  7. read_failure(unsigned int address, char const* message)
  8. : std::runtime_error("read_failure")
  9. {}
  10. };
  11.  
  12. int main()
  13. {
  14. try {
  15. throw read_failure(5, "lol");
  16. }
  17. catch (std::exception& ex) {
  18. std::cerr << "ERROR: " << ex.what() << std::endl;
  19. }
  20. }
Runtime error #stdin #stdout #stderr 0s 3424KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'read_failure'