-
Notifications
You must be signed in to change notification settings - Fork 2
scl::could_not_open_error Documentation
WizardCarter edited this page Aug 7, 2018
·
1 revision
scl::could_not_open_error is a custom exception within SCL. It is thrown when a config_file cannot be opened.
Returns a series of characters explaining the exception.
To make sure your code is as safe as possible, you should wrap your operations that use SCL within try-catch block.
try {
scl::config_file file("example.config", scl::config_file::READ);
int i = file.get<int>("integer value");
//do something with int here...
//file implicitly closed by destructor
} catch (std::exception& e) {
//handle the issue opening the file here
std::cerr << "Error: Exception thrown! Details : " << e.what() << '\n';
}