File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -538,23 +538,23 @@ The keyword `noexcept` is used to declare that a function is guaranteed to not t
538538#include <stdexcept>
539539using namespace std;
540540
541- int throw_if_zero(int i) noexcept {
541+ void throw_if_zero(int i) {
542542 if (!i) {
543543 throw runtime_error("found a zero");
544544 }
545545 println("throw_if_zero(): {}", i);
546546}
547547
548548int main() {
549- cout << "Entering main()\n" ;
549+ println( "Entering main()") ;
550550 try {
551551 throw_if_zero(1);
552552 throw_if_zero(0);
553553 }
554- catch(... ) {
555- println("Caught an exception!" );
554+ catch(exception& e ) {
555+ println("Caught an exception: {}", e.what() );
556556 }
557- println("Leaving main()\n ");
557+ println("Leaving main()");
558558}
559559```
560560
You can’t perform that action at this time.
0 commit comments