Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * system.cpp - basic system exceptions 00004 * 00005 * Generated: Sun Oct 29 14:28:17 2006 00006 * Copyright 2006 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <core/exceptions/system.h> 00025 00026 namespace fawkes { 00027 00028 /** @class OutOfMemoryException <core/exceptions/system.h> 00029 * System ran out of memory and desired operation could not be fulfilled. 00030 * @ingroup Exceptions 00031 */ 00032 /** Constructor 00033 * @param format message format string 00034 */ 00035 OutOfMemoryException::OutOfMemoryException(const char *format, ...) throw() 00036 : Exception() 00037 { 00038 va_list va; 00039 va_start(va, format); 00040 append_va(format, va); 00041 va_end(va); 00042 } 00043 00044 00045 /** Constructor. 00046 * Message simply is "Out of memory" 00047 */ 00048 OutOfMemoryException::OutOfMemoryException() throw() 00049 : Exception("Out of memory") 00050 { 00051 } 00052 00053 00054 /** @class InterruptedException <core/exceptions/system.h> 00055 * The current system call has been interrupted (for instance by a signal). 00056 * Throw this exception if you use libc functions which return EINTR or store 00057 * EINTR in errno. 00058 * @ingroup Exceptions 00059 */ 00060 /** Constructor */ 00061 InterruptedException::InterruptedException() throw() 00062 : Exception("Interrupted system call") 00063 { 00064 } 00065 00066 00067 /** Constructor 00068 * @param format message format string 00069 */ 00070 InterruptedException::InterruptedException(const char *format, ...) throw() 00071 : Exception() 00072 { 00073 va_list va; 00074 va_start(va, format); 00075 append_va(format, va); 00076 va_end(va); 00077 } 00078 00079 00080 /** @class TimeoutException <core/exceptions/system.h> 00081 * The current system call has timed out before completion. 00082 * Throw this exception for instance when a timed wait on a WaitCondition 00083 * timed out. 00084 * @ingroup Exceptions 00085 */ 00086 /** Constructor */ 00087 TimeoutException::TimeoutException() throw() 00088 : Exception("Timeout reached.") 00089 { 00090 } 00091 00092 00093 /** Constructor 00094 * @param format message format string 00095 */ 00096 TimeoutException::TimeoutException(const char *format, ...) throw() 00097 : Exception() 00098 { 00099 va_list va; 00100 va_start(va, format); 00101 append_va(format, va); 00102 va_end(va); 00103 } 00104 00105 00106 /** @class CouldNotOpenFileException <core/exceptions/system.h> 00107 * File could not be opened. 00108 * The file could not be opened. Optional error number and message describe the 00109 * problem in more detai. 00110 * @ingroup Exceptions 00111 */ 00112 00113 /** Constructor with error number. 00114 * @param filename name of file which could not be opened 00115 * @param errno error number 00116 * @param additional_msg optional additional message 00117 */ 00118 CouldNotOpenFileException::CouldNotOpenFileException(const char *filename, int errno, 00119 const char *additional_msg) throw() 00120 : Exception(errno, "Could not open file '%s' %s%s%s", filename, 00121 (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "", 00122 (additional_msg) ? ")" : "") 00123 { 00124 } 00125 00126 00127 /** Constructor with error number. 00128 * @param filename name of file which could not be opened 00129 * @param additional_msg optional additional message 00130 */ 00131 CouldNotOpenFileException::CouldNotOpenFileException(const char *filename, 00132 const char *additional_msg) throw() 00133 : Exception("Could not open file '%s' %s%s%s", filename, 00134 (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "", 00135 (additional_msg) ? ")" : "") 00136 { 00137 } 00138 00139 00140 /** @class FileReadException <core/exceptions/system.h> 00141 * File could not be read. 00142 * The file could not be read. Optional error number and message describe the 00143 * problem in more detail. 00144 * @ingroup Exceptions 00145 */ 00146 00147 /** Constructor with error number. 00148 * @param filename name of file which could not be read 00149 * @param errno error number 00150 * @param additional_msg optional additional message 00151 */ 00152 FileReadException::FileReadException(const char *filename, int errno, 00153 const char *additional_msg) throw() 00154 : Exception(errno, "Could read from file '%s' %s%s%s", filename, 00155 (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "", 00156 (additional_msg) ? ")" : "") 00157 { 00158 } 00159 00160 00161 /** Constructor with error number. 00162 * @param filename name of file which could not be read 00163 * @param additional_msg optional additional message 00164 */ 00165 FileReadException::FileReadException(const char *filename, 00166 const char *additional_msg) throw() 00167 : Exception("Could read from file '%s' %s%s%s", filename, 00168 (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "", 00169 (additional_msg) ? ")" : "") 00170 { 00171 } 00172 00173 00174 /** @class FileWriteException <core/exceptions/system.h> 00175 * Could not write to file. 00176 * Writing to a file failed. Optional error number and message describe the 00177 * problem in more detail. 00178 * @ingroup Exceptions 00179 */ 00180 00181 /** Constructor with error number. 00182 * @param filename name of file which could not be written to 00183 * @param errno error number 00184 * @param additional_msg optional additional message 00185 */ 00186 FileWriteException::FileWriteException(const char *filename, int errno, 00187 const char *additional_msg) throw() 00188 : Exception(errno, "Could write to file '%s' %s%s%s", filename, 00189 (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "", 00190 (additional_msg) ? ")" : "") 00191 { 00192 } 00193 00194 00195 /** Constructor with error number. 00196 * @param filename name of file which could not be written 00197 * @param additional_msg optional additional message 00198 */ 00199 FileWriteException::FileWriteException(const char *filename, 00200 const char *additional_msg) throw() 00201 : Exception("Could write to file '%s' %s%s%s", filename, 00202 (additional_msg) ? "(" : "", (additional_msg) ? additional_msg : "", 00203 (additional_msg) ? ")" : "") 00204 { 00205 } 00206 00207 00208 } // end namespace fawkes