comparison base/Exceptions.cpp @ 544:65d955c4d671

* throw (but do not yet catch!) exception when running out of disc space in coded audio file * simpler (faster?) cache-to-cache move operation in spectrogram, and some other minor fixes
author Chris Cannam
date Wed, 04 Feb 2009 12:13:16 +0000
parents 7aa1de571880
children b4a8d8221eaf
comparison
equal deleted inserted replaced
543:7a66b94ef1c0 544:65d955c4d671
98 std::cerr << "ERROR: Not enough disc space available in " 98 std::cerr << "ERROR: Not enough disc space available in "
99 << directory.toStdString() << ": need " << required 99 << directory.toStdString() << ": need " << required
100 << ", only have " << available << std::endl; 100 << ", only have " << available << std::endl;
101 } 101 }
102 102
103 InsufficientDiscSpace::InsufficientDiscSpace(QString directory) throw() :
104 m_directory(directory),
105 m_required(0),
106 m_available(0)
107 {
108 std::cerr << "ERROR: Not enough disc space available in "
109 << directory.toStdString() << std::endl;
110 }
111
103 const char * 112 const char *
104 InsufficientDiscSpace::what() const throw() 113 InsufficientDiscSpace::what() const throw()
105 { 114 {
106 return QString("Not enough space available in \"%1\": need %2, have %3") 115 if (m_required > 0) {
107 .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data(); 116 return QString("Not enough space available in \"%1\": need %2, have %3")
117 .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
118 } else {
119 return QString("Not enough space available in \"%1\"")
120 .arg(m_directory).toLocal8Bit().data();
121 }
108 } 122 }
109 123
110 AllocationFailed::AllocationFailed(QString purpose) throw() : 124 AllocationFailed::AllocationFailed(QString purpose) throw() :
111 m_purpose(purpose) 125 m_purpose(purpose)
112 { 126 {