Permalink
Browse files

Cover all of main() with try.

  • Loading branch information...
1 parent 105bb80 commit 66e7c1c576ac176281672b37a5ffdb35af35a47c @uckelman committed Oct 28, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/main.cpp
View
@@ -49,15 +49,15 @@ void destroy_file(libpff_file_t* file) {
}
int main(int argc, char** argv) {
- if (argc != 2) {
- throw std::runtime_error("Wrong number arguments");
- }
+ try {
+ if (argc != 2) {
+ throw std::runtime_error("wrong number of arguments");
+ }
- libpff_error_t* error = 0;
+ libpff_error_t* error = 0;
- boost::shared_ptr<libpff_file_t> file(create_file(), &destroy_file);
+ boost::shared_ptr<libpff_file_t> file(create_file(), &destroy_file);
- try {
if (libpff_file_open(file.get(), argv[1], LIBPFF_OPEN_READ, &error) != 1) {
throw libpff_error(error);
}
@@ -69,7 +69,7 @@ int main(int argc, char** argv) {
}
}
catch (const std::exception& e) {
- std::cerr << e.what() << std::endl;
+ std::cerr << "Error: " << e.what() << std::endl;
return EXIT_FAILURE;
}

0 comments on commit 66e7c1c

Please sign in to comment.