diff 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
line wrap: on
line diff
--- a/base/Exceptions.cpp	Wed Feb 04 10:53:38 2009 +0000
+++ b/base/Exceptions.cpp	Wed Feb 04 12:13:16 2009 +0000
@@ -100,11 +100,25 @@
               << ", only have " << available << std::endl;
 }
 
+InsufficientDiscSpace::InsufficientDiscSpace(QString directory) throw() :
+    m_directory(directory),
+    m_required(0),
+    m_available(0)
+{
+    std::cerr << "ERROR: Not enough disc space available in "
+              << directory.toStdString() << std::endl;
+}
+
 const char *
 InsufficientDiscSpace::what() const throw()
 {
-    return QString("Not enough space available in \"%1\": need %2, have %3")
-        .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
+    if (m_required > 0) {
+        return QString("Not enough space available in \"%1\": need %2, have %3")
+            .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
+    } else {
+        return QString("Not enough space available in \"%1\"")
+            .arg(m_directory).toLocal8Bit().data();
+    }
 }
 
 AllocationFailed::AllocationFailed(QString purpose) throw() :