Skip to content

Commit

Permalink
Catch exceptions in main
Browse files Browse the repository at this point in the history
  • Loading branch information
jarulraj committed Aug 30, 2017
1 parent 0bf8916 commit ac8a9a5
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@ Configuration state;

int main(int argc, char **argv) {

sqlcheck::ParseArguments(
argc, argv, sqlcheck::state);
try {

sqlcheck::Check(sqlcheck::state);
// Parse the input arguments from the user
// This customizes the checker configuration
sqlcheck::ParseArguments(
argc, argv, sqlcheck::state);

return 0;
// Invoke the checker
sqlcheck::Check(sqlcheck::state);

}
// Catching at the top level ensures that
// destructors are always called
catch (std::exception& exc) {
std::cerr << exc.what() << std::endl;
exit(EXIT_FAILURE);
}

return (EXIT_SUCCESS);
}

0 comments on commit ac8a9a5

Please sign in to comment.