Ignore:
Timestamp:
Nov 17, 2008, 10:24:18 PM (14 years ago)
Author:
Peter
Message:

improving exception message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/OptionFile.cc

    r1487 r1628  
    4848      return;
    4949    FileUtil fu(value().c_str());
    50     if (exist_ && !fu.exists()){
     50    bool exists=false;
     51    try {
     52      exists = fu.exists();
     53    }
     54    catch (IO_error& e) {
     55      std::stringstream ss;
     56      ss << "cannot stat `" << value() << "': " << strerror(errno);
     57      errno = 0;
     58      throw cmd_error(ss.str());
     59    }
     60    if (exist_ && !exists){
    5161      std::stringstream ss;
    5262      ss << "cannot stat `" << value() << "': No such file or directory";
     
    5868        if (*iter=='r' && fu.permissions("r")){
    5969          std::stringstream ss;
    60           ss << "cannot stat `" << value() << "': No such file or directory";
     70          ss << "cannot open `" << value() << "' for reading: Permission denied";
    6171          throw cmd_error(ss.str());
    6272        }
Note: See TracChangeset for help on using the changeset viewer.