annotate base/Exceptions.cpp @ 822:54829c1e155e tonioni

Merge from the default branch
author Chris Cannam
date Fri, 12 Jul 2013 13:10:28 +0100
parents b4a8d8221eaf
children e802e550a1f2
rev   line source
Chris@130 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@130 2
Chris@130 3 /*
Chris@130 4 Sonic Visualiser
Chris@130 5 An audio file viewer and annotation editor.
Chris@130 6 Centre for Digital Music, Queen Mary, University of London.
Chris@130 7 This file copyright 2006 Chris Cannam.
Chris@130 8
Chris@130 9 This program is free software; you can redistribute it and/or
Chris@130 10 modify it under the terms of the GNU General Public License as
Chris@130 11 published by the Free Software Foundation; either version 2 of the
Chris@130 12 License, or (at your option) any later version. See the file
Chris@130 13 COPYING included with this distribution for more information.
Chris@130 14 */
Chris@130 15
Chris@130 16 #include "Exceptions.h"
Chris@130 17
Chris@130 18 #include <iostream>
Chris@130 19
Chris@130 20 FileNotFound::FileNotFound(QString file) throw() :
Chris@130 21 m_file(file)
Chris@130 22 {
Chris@130 23 std::cerr << "ERROR: File not found: "
Chris@686 24 << file << std::endl;
Chris@130 25 }
Chris@130 26
Chris@130 27 const char *
Chris@130 28 FileNotFound::what() const throw()
Chris@130 29 {
Chris@130 30 return QString("File \"%1\" not found")
Chris@130 31 .arg(m_file).toLocal8Bit().data();
Chris@130 32 }
Chris@130 33
Chris@130 34 FailedToOpenFile::FailedToOpenFile(QString file) throw() :
Chris@130 35 m_file(file)
Chris@130 36 {
Chris@130 37 std::cerr << "ERROR: Failed to open file: "
Chris@686 38 << file << std::endl;
Chris@130 39 }
Chris@130 40
Chris@130 41 const char *
Chris@130 42 FailedToOpenFile::what() const throw()
Chris@130 43 {
Chris@130 44 return QString("Failed to open file \"%1\"")
Chris@130 45 .arg(m_file).toLocal8Bit().data();
Chris@130 46 }
Chris@130 47
Chris@130 48 DirectoryCreationFailed::DirectoryCreationFailed(QString directory) throw() :
Chris@130 49 m_directory(directory)
Chris@130 50 {
Chris@130 51 std::cerr << "ERROR: Directory creation failed for directory: "
Chris@686 52 << directory << std::endl;
Chris@130 53 }
Chris@130 54
Chris@130 55 const char *
Chris@130 56 DirectoryCreationFailed::what() const throw()
Chris@130 57 {
Chris@130 58 return QString("Directory creation failed for \"%1\"")
Chris@130 59 .arg(m_directory).toLocal8Bit().data();
Chris@130 60 }
Chris@130 61
Chris@130 62 FileReadFailed::FileReadFailed(QString file) throw() :
Chris@130 63 m_file(file)
Chris@130 64 {
Chris@130 65 std::cerr << "ERROR: File read failed for file: "
Chris@686 66 << file << std::endl;
Chris@130 67 }
Chris@130 68
Chris@130 69 const char *
Chris@130 70 FileReadFailed::what() const throw()
Chris@130 71 {
Chris@130 72 return QString("File read failed for \"%1\"")
Chris@130 73 .arg(m_file).toLocal8Bit().data();
Chris@130 74 }
Chris@130 75
Chris@130 76 FileOperationFailed::FileOperationFailed(QString file, QString op) throw() :
Chris@130 77 m_file(file),
Chris@130 78 m_operation(op)
Chris@130 79 {
Chris@686 80 std::cerr << "ERROR: File " << op << " failed for file: "
Chris@686 81 << file << std::endl;
Chris@130 82 }
Chris@130 83
Chris@130 84 const char *
Chris@130 85 FileOperationFailed::what() const throw()
Chris@130 86 {
Chris@130 87 return QString("File %1 failed for \"%2\"")
Chris@130 88 .arg(m_operation).arg(m_file).toLocal8Bit().data();
Chris@130 89 }
Chris@130 90
Chris@130 91 InsufficientDiscSpace::InsufficientDiscSpace(QString directory,
Chris@130 92 size_t required,
Chris@130 93 size_t available) throw() :
Chris@130 94 m_directory(directory),
Chris@130 95 m_required(required),
Chris@130 96 m_available(available)
Chris@130 97 {
Chris@130 98 std::cerr << "ERROR: Not enough disc space available in "
Chris@686 99 << directory << ": need " << required
Chris@130 100 << ", only have " << available << std::endl;
Chris@130 101 }
Chris@130 102
Chris@544 103 InsufficientDiscSpace::InsufficientDiscSpace(QString directory) throw() :
Chris@544 104 m_directory(directory),
Chris@544 105 m_required(0),
Chris@544 106 m_available(0)
Chris@544 107 {
Chris@544 108 std::cerr << "ERROR: Not enough disc space available in "
Chris@686 109 << directory << std::endl;
Chris@544 110 }
Chris@544 111
Chris@130 112 const char *
Chris@130 113 InsufficientDiscSpace::what() const throw()
Chris@130 114 {
Chris@544 115 if (m_required > 0) {
Chris@544 116 return QString("Not enough space available in \"%1\": need %2, have %3")
Chris@544 117 .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
Chris@544 118 } else {
Chris@544 119 return QString("Not enough space available in \"%1\"")
Chris@544 120 .arg(m_directory).toLocal8Bit().data();
Chris@544 121 }
Chris@130 122 }
Chris@130 123
Chris@387 124 AllocationFailed::AllocationFailed(QString purpose) throw() :
Chris@387 125 m_purpose(purpose)
Chris@387 126 {
Chris@387 127 std::cerr << "ERROR: Allocation failed: " << purpose.toStdString()
Chris@387 128 << std::endl;
Chris@387 129 }
Chris@387 130
Chris@387 131 const char *
Chris@387 132 AllocationFailed::what() const throw()
Chris@387 133 {
Chris@387 134 return QString("Allocation failed: %1")
Chris@387 135 .arg(m_purpose).toLocal8Bit().data();
Chris@387 136 }
Chris@387 137
Chris@387 138