Changeset 1215 for trunk/lib/SVN.cc


Ignore:
Timestamp:
Oct 10, 2010, 1:41:30 AM (12 years ago)
Author:
Peter Johansson
Message:

extending SVNException to also hold/take svn_error_t. refs #371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SVN.cc

    r1214 r1215  
    3838#include <subversion-1/svn_subst.h>
    3939
     40#include <sstream>
     41#include <string>
     42
    4043namespace theplu {
    4144namespace svndigest {
     45
     46
     47  SVNException::SVNException(const std::string& msg, svn_error_t* error)
     48    : std::runtime_error(""), error_(error), msg_(msg) {}
     49
     50
     51  SVNException::~SVNException(void) throw() {}
     52
     53
     54  const char* SVNException::what(void) const throw()
     55  {
     56    std::stringstream ss;
     57    if (error_) {
     58      apr_size_t bufsize=255;
     59      char buf[255];
     60      ss << svn_err_best_message(error_, buf, bufsize);
     61    }
     62    if (msg_.size()) {
     63      ss << msg_;
     64    }
     65   
     66    return ss.str().c_str();
     67  }
     68
     69
     70  const svn_error_t* SVNException::error(void) const
     71  {
     72    return error_;
     73  }
    4274
    4375
Note: See TracChangeset for help on using the changeset viewer.