Changeset 1186 for trunk/lib/utility.cc


Ignore:
Timestamp:
Aug 28, 2010, 12:13:37 AM (13 years ago)
Author:
Peter Johansson
Message:

using errno_error. closes #410

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/utility.cc

    r1132 r1186  
    170170
    171171
     172  void lstat(const std::string path, struct stat* nodestat)
     173  {
     174    int res = ::lstat(path.c_str(), nodestat);
     175    if (res) {
     176      throw yat::utility::errno_error("lstat: ");
     177    }
     178  }
     179
     180
    172181  std::string ltrim(std::string str)
    173182  {
     
    183192    if (code){
    184193      std::stringstream ss;
    185       ss << "mkdir(" << dir << "): failed\n" << strerror(errno);
    186       throw std::runtime_error(ss.str());
     194      ss << "mkdir: `" << dir << "': ";
     195      throw yat::utility::errno_error(ss.str());
    187196    }
    188197  }
     
    294303    if (code){
    295304      std::stringstream ss;
    296       ss << "rename(" << from << ", " << to << "): failed\n" << strerror(errno);
    297       throw std::runtime_error(ss.str());
     305      ss << "rename" << from << " to " << to << ": ";
     306      throw yat::utility::errno_error(ss.str());
    298307    }
    299308  }
Note: See TracChangeset for help on using the changeset viewer.