2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-11-14 08:29:32 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2004-02-29 00:50:05 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2004-02-29 00:50:05 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2004-02-29 00:50:05 +00:00
|
|
|
|
|
|
|
#ifndef _BOINC_EXCEPTIONS_
|
|
|
|
#define _BOINC_EXCEPTIONS_
|
|
|
|
|
2004-03-24 19:47:51 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
#include <string>
|
|
|
|
#endif
|
|
|
|
|
2004-06-04 13:52:54 +00:00
|
|
|
#include <exception>
|
2004-02-29 00:50:05 +00:00
|
|
|
|
|
|
|
// BOINC Base Exception Class
|
|
|
|
//
|
|
|
|
|
2004-06-30 18:17:21 +00:00
|
|
|
class boinc_base_exception : public std::exception
|
2004-02-29 00:50:05 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
private:
|
|
|
|
char m_szConversionBuffer[66]; // convert numbers to strings largest
|
|
|
|
// datatype is 64bits plus the
|
|
|
|
// possible sign character and the
|
|
|
|
// NULL terminator
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string m_strErrorBuffer; // the formatted error message when
|
2004-02-29 00:50:05 +00:00
|
|
|
// asked
|
|
|
|
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string m_strErrorType; // the error type
|
2004-05-03 21:01:49 +00:00
|
|
|
long m_lErrorValue; // the error value
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string m_strErrorMessage; // the error message
|
|
|
|
std::string m_strErrorData; // any relevant data associated with
|
2004-02-29 00:50:05 +00:00
|
|
|
// the error
|
2004-06-30 18:17:21 +00:00
|
|
|
std::string m_strFilename; // the file in which the error occurred
|
2004-02-29 00:50:05 +00:00
|
|
|
long m_lLineNumber; // the line number in which the error
|
|
|
|
// occurred
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
boinc_base_exception(const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: m_strErrorType(ErrorType()), m_lErrorValue(ErrorValue()), m_strErrorMessage(ErrorMessage()), m_strErrorData(s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
|
|
|
boinc_base_exception(const char *f, int l, const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: m_strErrorType(ErrorType()), m_lErrorValue(ErrorValue()), m_strErrorMessage(ErrorMessage()), m_strErrorData(s), m_strFilename(f), m_lLineNumber(l){};
|
|
|
|
|
|
|
|
boinc_base_exception(const char *et, long ev, const char *em, const char *s=0)
|
|
|
|
: m_strErrorType(et), m_lErrorValue(ev), m_strErrorMessage(em), m_strErrorData(s){};
|
|
|
|
|
|
|
|
boinc_base_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0)
|
|
|
|
: m_strErrorType(et), m_lErrorValue(ev), m_strErrorMessage(em), m_strErrorData(s), m_strFilename(f), m_lLineNumber(l){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
2004-03-24 20:06:42 +00:00
|
|
|
~boinc_base_exception() throw () {};
|
|
|
|
|
2004-02-29 00:50:05 +00:00
|
|
|
virtual const char * ErrorType();
|
|
|
|
virtual const char * ErrorMessage();
|
|
|
|
virtual long ErrorValue();
|
|
|
|
|
|
|
|
virtual const char * what();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// BOINC Base Runtime Exception Class
|
|
|
|
//
|
|
|
|
|
|
|
|
class boinc_runtime_base_exception : public boinc_base_exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2004-03-24 07:39:24 +00:00
|
|
|
boinc_runtime_base_exception(const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
boinc_runtime_base_exception(const char *f, int l, const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){};
|
|
|
|
boinc_runtime_base_exception(const char *et, long ev, const char *em, const char *s=0)
|
|
|
|
: boinc_base_exception(et, ev, em, s){};
|
|
|
|
boinc_runtime_base_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0)
|
|
|
|
: boinc_base_exception(et, ev, em, f, l, s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
2004-03-24 20:06:42 +00:00
|
|
|
~boinc_runtime_base_exception() throw () {};
|
|
|
|
|
2004-02-29 00:50:05 +00:00
|
|
|
virtual const char * ErrorType();
|
|
|
|
virtual const char * ErrorMessage();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// BOINC Runtime Exceptions
|
|
|
|
//
|
|
|
|
|
|
|
|
class boinc_out_of_memory_exception : public boinc_runtime_base_exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
boinc_out_of_memory_exception(const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
boinc_out_of_memory_exception(const char *f, int l, const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){};
|
|
|
|
boinc_out_of_memory_exception(const char *et, long ev, const char *em, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, s){};
|
|
|
|
boinc_out_of_memory_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, f, l, s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
2004-03-24 20:06:42 +00:00
|
|
|
~boinc_out_of_memory_exception() throw () {};
|
|
|
|
|
2004-02-29 00:50:05 +00:00
|
|
|
virtual const char * ErrorMessage();
|
|
|
|
virtual long ErrorValue();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class boinc_invalid_parameter_exception : public boinc_runtime_base_exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
boinc_invalid_parameter_exception(const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
boinc_invalid_parameter_exception(const char *f, int l, const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){};
|
|
|
|
boinc_invalid_parameter_exception(const char *et, long ev, const char *em, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, s){};
|
|
|
|
boinc_invalid_parameter_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, f, l, s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
2004-03-24 20:06:42 +00:00
|
|
|
~boinc_invalid_parameter_exception() throw () {};
|
|
|
|
|
2004-02-29 00:50:05 +00:00
|
|
|
virtual const char * ErrorMessage();
|
|
|
|
virtual long ErrorValue();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class boinc_file_operation_exception : public boinc_runtime_base_exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
boinc_file_operation_exception(const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
boinc_file_operation_exception(const char *f, int l, const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){};
|
|
|
|
boinc_file_operation_exception(const char *et, long ev, const char *em, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, s){};
|
|
|
|
boinc_file_operation_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, f, l, s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
2004-03-24 20:06:42 +00:00
|
|
|
~boinc_file_operation_exception() throw () {};
|
|
|
|
|
2004-02-29 00:50:05 +00:00
|
|
|
virtual const char * ErrorMessage();
|
|
|
|
virtual long ErrorValue();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class boinc_signal_operation_exception : public boinc_runtime_base_exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
boinc_signal_operation_exception(const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
boinc_signal_operation_exception(const char *f, int l, const char *s=0)
|
2004-05-03 21:01:49 +00:00
|
|
|
: boinc_runtime_base_exception(ErrorType(), ErrorValue(), ErrorMessage(), f, l, s){};
|
|
|
|
boinc_signal_operation_exception(const char *et, long ev, const char *em, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, s){};
|
|
|
|
boinc_signal_operation_exception(const char *et, long ev, const char *em, const char *f, int l, const char *s=0)
|
|
|
|
: boinc_runtime_base_exception(et, ev, em, f, l, s){};
|
2004-02-29 00:50:05 +00:00
|
|
|
|
2004-03-24 20:06:42 +00:00
|
|
|
~boinc_signal_operation_exception() throw () {};
|
|
|
|
|
2004-02-29 00:50:05 +00:00
|
|
|
virtual const char * ErrorMessage();
|
|
|
|
virtual long ErrorValue();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|