8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 12:43:03 +01:00

Added 2 new exceptions

Cleanup
This commit is contained in:
alexpeshkoff 2002-11-11 18:06:01 +00:00
parent 648f0bfb73
commit 81b3d5593e
2 changed files with 58 additions and 6 deletions

View File

@ -1,6 +1,38 @@
#include "fb_exception.h"
void Firebird::status_exception::raise(STATUS s)
#include <string.h>
namespace Firebird {
void status_exception::raise(STATUS s)
{
throw status_exception(s);
}
void red_zone_error::raise()
{
throw red_zone_error();
}
void memory_corrupt::raise()
{
throw memory_corrupt();
}
void system_call_failed::raise()
{
throw system_call_failed();
}
fatal_exception::fatal_exception(char *message)
{
strncpy(txt, message, 255);
txt[255] = 0;
}
void fatal_exception::raise(char *message)
{
throw fatal_exception(message);
}
} // namespace Firebird

View File

@ -40,7 +40,6 @@ public:
{ return "Firebird::status_exception"; }
STATUS value() const { return m_s; }
// TMN: to be moved into its own source file!
static void raise(STATUS s);
private:
@ -53,8 +52,7 @@ public:
virtual const char* what() const throw()
{ return "Firebird::red_zone_error"; }
// TMN: to be moved into its own source file!
static void raise() { throw red_zone_error(); }
static void raise();
};
class memory_corrupt : public std::exception
@ -63,8 +61,30 @@ public:
virtual const char* what() const throw()
{ return "Firebird::memory_corrupt"; }
// TMN: to be moved into its own source file!
static void raise() { throw memory_corrupt(); }
static void raise();
};
class system_call_failed : public std::exception
{
public:
virtual const char* what() const throw()
{ return "Firebird::system_call_failed"; }
static void raise();
};
class fatal_exception : public std::exception
{
public:
explicit fatal_exception(char *message);
virtual ~fatal_exception() throw() {}
virtual const char* what() const throw()
{ return txt; }
static void raise(char *message);
private:
char txt[256];
};
} // namespace Firebird