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
538
538
#include <stdexcept>
539
539
using namespace std;
540
540
541
- int throw_if_zero(int i) noexcept {
541
+ void throw_if_zero(int i) {
542
542
if (!i) {
543
543
throw runtime_error("found a zero");
544
544
}
545
545
println("throw_if_zero(): {}", i);
546
546
}
547
547
548
548
int main() {
549
- cout << "Entering main()\n" ;
549
+ println( "Entering main()") ;
550
550
try {
551
551
throw_if_zero(1);
552
552
throw_if_zero(0);
553
553
}
554
- catch(... ) {
555
- println("Caught an exception!" );
554
+ catch(exception& e ) {
555
+ println("Caught an exception: {}", e.what() );
556
556
}
557
- println("Leaving main()\n ");
557
+ println("Leaving main()");
558
558
}
559
559
```
560
560
You can’t perform that action at this time.
0 commit comments