1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
//$$FILE$$
//$$VERSION$$
//$$DATE$$
//$$LICENSE$$
/**
** \file Exceptions.h
**
** Declarations of exceptions in RCSB code.
*/
#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <stdexcept>
#include <string>
/// Base class for all RCSB exceptions
class RcsbException : public std::exception
{
protected:
std::string _message;
public:
RcsbException(const std::string& message = std::string(),
const std::string& location = std::string());
~RcsbException() throw();
void AppendMessage(const std::string& message = std::string(),
const std::string& location = std::string());
const char* what() const throw();
};
/// Empty value exception (e.g. NULL pointer, empty string)
class EmptyValueException : public RcsbException
{
public:
EmptyValueException(const std::string& message = std::string(),
const std::string& location = std::string());
~EmptyValueException() throw();
};
/// Object not found (thrown everywhere except from .find() methods)
class NotFoundException : public RcsbException
{
public:
NotFoundException(const std::string& message = std::string(),
const std::string& location = std::string());
~NotFoundException() throw();
};
/// Object already exists
class AlreadyExistsException : public RcsbException
{
public:
AlreadyExistsException(const std::string& message = std::string(),
const std::string& location = std::string());
~AlreadyExistsException() throw();
};
/// Empty container
class EmptyContainerException : public RcsbException
{
public:
EmptyContainerException(const std::string& message = std::string(),
const std::string& location = std::string());
~EmptyContainerException() throw();
};
/// File mode exception (e.g. attempt to write to read-only file, invalid mode.)
class FileModeException : public RcsbException
{
public:
FileModeException(const std::string& message = std::string(),
const std::string& location = std::string());
~FileModeException() throw();
};
/// Invalid state exception (e.g. getting a row reference in a column-wise table/// )
class InvalidStateException : public RcsbException
{
public:
InvalidStateException(const std::string& message = std::string(),
const std::string& location = std::string());
~InvalidStateException() throw();
};
/// Generic files related exception (e.g. read error, write errror, etc.)
class FileException : public RcsbException
{
public:
FileException(const std::string& message = std::string(),
const std::string& location = std::string());
~FileException() throw();
};
/// Invalid command line options
class InvalidOptionsException : public RcsbException
{
public:
InvalidOptionsException(const std::string& message = std::string(),
const std::string& location = std::string());
~InvalidOptionsException() throw();
};
/// Versions do not match
class VersionMismatchException : public RcsbException
{
public:
VersionMismatchException(const std::string& message = std::string(),
const std::string& location = std::string());
~VersionMismatchException() throw();
};
#endif
|