Place util exceptions in the util namespace

This commit is contained in:
Danny Robson 2012-05-16 15:01:01 +10:00
parent c6a3831840
commit 6e82915975
2 changed files with 33 additions and 31 deletions

View File

@ -25,6 +25,7 @@
#include <cerrno>
using namespace std;
using namespace util;
/// Construct an errno_error from a given error value. The error value MUST signal an error at

View File

@ -26,24 +26,25 @@
#include <stdexcept>
class input_error : public std::runtime_error {
namespace util {
class input_error : public std::runtime_error {
public:
input_error (const std::string &_what):
runtime_error (_what)
{ ; }
};
};
class unavailable_error : public std::runtime_error {
class unavailable_error : public std::runtime_error {
public:
unavailable_error (const std::string &_what):
runtime_error (_what)
{ ; }
};
};
/// An exception class used for reporting errors signalled by errno.
class errno_error : public std::runtime_error {
/// An exception class used for reporting errors signalled by errno.
class errno_error : public std::runtime_error {
public:
int id;
errno_error (int _errno);
@ -54,13 +55,13 @@ class errno_error : public std::runtime_error {
static void throw_code (void);
static void throw_code (int code);
};
};
#if defined(PLATFORM_WIN32)
#include <windows.h>
class win32_error : public std::runtime_error {
class win32_error : public std::runtime_error {
public:
DWORD id;
@ -69,8 +70,8 @@ class win32_error : public std::runtime_error {
static void try_code (void);
static void throw_code (void);
};
};
#endif
}
#endif