0
How do you use std::logic_error to pass a string exception?
my code is something like this try{ //some code throw std::logic error("A string") }catch( std::logic_error string_caught) { cout << string_caught << endl; } I try doing it this way but i get errors. i need someone to provide a working example so that i can understand it better.
2 Réponses
+ 1
Try to use:
cout << string_caught.what() << endl;
+ 1
Thanks! That worked :)