~ubuntu-branches/ubuntu/quantal/aria2/quantal

« back to all changes in this revision

Viewing changes to src/Exception.cc

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2010-11-24 12:26:31 UTC
  • mfrom: (1.6.1 upstream) (2.3.8 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124122631-upujekj1ek94h3x2
Tags: 1.10.6-1
* New upstream release:
  + Fixed FTBFS on alpha arch (Closes: #590257)
  + Added IPv6 support (Closes: #448390)
* debian/patches/ftbfs_kfreebsd.diff:
  + Dropped, merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
namespace aria2 {
40
40
 
41
41
Exception::Exception(const char* file, int line, const std::string& msg):
42
 
  file_(file), line_(line), msg_(msg) {}
 
42
  file_(file), line_(line), errno_(0),  msg_(msg) {}
43
43
 
44
44
Exception::Exception(const char* file, int line, const std::string& msg,
45
45
                     const Exception& cause):
46
 
  file_(file), line_(line), msg_(msg), cause_(cause.copy()) {}
 
46
  file_(file), line_(line), errno_(0), msg_(msg), cause_(cause.copy()) {}
47
47
 
48
48
Exception::Exception(const char* file, int line, const Exception& e):
49
 
  file_(file), line_(line), msg_(e.msg_), cause_(e.cause_)
 
49
  file_(file), line_(line), errno_(0), msg_(e.msg_), cause_(e.cause_)
50
50
{}
51
51
 
 
52
Exception::Exception
 
53
(const char* file, int line, int errnoArg, const std::string& msg):
 
54
  file_(file), line_(line), errno_(errnoArg), msg_(msg) {}
 
55
 
52
56
Exception::~Exception() throw() {}
53
57
 
54
 
const char* Exception::what() const throw()
55
 
{
56
 
  return msg_.c_str();
57
 
}
58
 
 
59
 
std::string Exception::stackTrace() const throw()
 
58
std::string Exception::stackTrace() const
60
59
{
61
60
  std::stringstream s;
62
 
  s << "Exception: " << "[" << file_ << ":" << line_ << "] " << what() << "\n";
 
61
  s << "Exception: " << "[" << file_ << ":" << line_ << "] ";
 
62
  if(errno_) {
 
63
    s << "errno=" << errno_ << " ";
 
64
  }
 
65
  s  << what() << "\n";
63
66
  SharedHandle<Exception> e = cause_;
64
67
  while(!e.isNull()) {
65
68
    s << "  -> " << "[" << e->file_ << ":" << e->line_ << "] "