File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #include " exceptions.h"
2+
3+ namespace sw
4+ {
5+
6+ RuntimeError::RuntimeError (const std::string &msg)
7+ : std::runtime_error(" " )
8+ {
9+ }
10+
11+ } // namespace sw
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < stdexcept>
4+ #include < string>
5+
6+ namespace sw
7+ {
8+
9+ struct API RuntimeError : std::runtime_error
10+ {
11+ RuntimeError (const std::string &msg);
12+ };
13+
14+ }
Original file line number Diff line number Diff line change 1+ #include " exceptions.h"
2+
3+ #include < iostream>
4+
5+ void f ()
6+ {
7+ try { throw 5 ; }
8+ catch (int ) { std::cout << " int\n " ; }
9+ try { throw sw::RuntimeError (" " ); }
10+ catch (sw::RuntimeError) { std::cout << " sw::RuntimeError\n " ; }
11+ }
12+
13+ int main ()
14+ {
15+ f ();
16+ return 0 ;
17+ }
Original file line number Diff line number Diff line change 1+ void build (Solution &s)
2+ {
3+ auto &lib = s.addStaticLibrary (" lib" );
4+ lib.ApiName = " API" ;
5+ lib += " exceptions.h" ;
6+ lib += " exceptions.cpp" ;
7+
8+ auto &t = s.addExecutable (" test" );
9+ t += " main.cpp" ;
10+ t += lib;
11+ }
You can’t perform that action at this time.
0 commit comments