annotate base/Exceptions.cpp @ 490:c3fb8258e34d

* Make it possible to import an entire session from an RDF document. However, at the moment the timings of events appear to be constrained by how far the audio decoder has got through its audio file at the time the event is queried -- need to investigate.
author Chris Cannam
date Fri, 21 Nov 2008 18:03:14 +0000
parents 7aa1de571880
children 65d955c4d671
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@130 24 << file.toStdString() << 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@130 38 << file.toStdString() << 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@130 52 << directory.toStdString() << 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@130 66 << file.toStdString() << 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@130 80 std::cerr << "ERROR: File " << op.toStdString() << " failed for file: "
Chris@130 81 << file.toStdString() << 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@130 99 << directory.toStdString() << ": need " << required
Chris@130 100 << ", only have " << available << std::endl;
Chris@130 101 }
Chris@130 102
Chris@130 103 const char *
Chris@130 104 InsufficientDiscSpace::what() const throw()
Chris@130 105 {
Chris@130 106 return QString("Not enough space available in \"%1\": need %2, have %3")
Chris@130 107 .arg(m_directory).arg(m_required).arg(m_available).toLocal8Bit().data();
Chris@130 108 }
Chris@130 109
Chris@387 110 AllocationFailed::AllocationFailed(QString purpose) throw() :
Chris@387 111 m_purpose(purpose)
Chris@387 112 {
Chris@387 113 std::cerr << "ERROR: Allocation failed: " << purpose.toStdString()
Chris@387 114 << std::endl;
Chris@387 115 }
Chris@387 116
Chris@387 117 const char *
Chris@387 118 AllocationFailed::what() const throw()
Chris@387 119 {
Chris@387 120 return QString("Allocation failed: %1")
Chris@387 121 .arg(m_purpose).toLocal8Bit().data();
Chris@387 122 }
Chris@387 123
Chris@387 124