47
45
// Forward declaration of implementation-specific structure
48
class error_description;
46
class ErrorDescription;
49
47
} // namespace detail
51
namespace version_1_9_dev {
53
class error : public std::exception
50
* Exceptions generated by the C++HL implementation.
52
class InternalError : public std::exception
56
typedef compat::shared_ptr<error> shared_ptr;
58
error(const char* description, int error_code);
59
error(const char* description, int error_code, shared_ptr nested_error);
61
error(const error& that) throw();
62
error& operator=(const error& that) throw();
63
virtual ~error() throw();
66
* Returns the error code associated with the exception.
68
virtual int code() const throw() { return m_errno; }
71
* Returns a shared pointer to the nested exception object, if any.
73
virtual shared_ptr nested() const throw() { return m_nested; }
75
/// Returns the message associated with this exception object.
55
explicit InternalError(const char* description);
57
InternalError(const InternalError& that) throw();
58
InternalError& operator= (const InternalError& that) throw();
59
virtual ~InternalError() throw();
62
* Returns the message associated with this exception object.
76
64
virtual const char* what() const throw();
67
typedef compat::shared_ptr<detail::ErrorDescription> description_ptr;
68
explicit InternalError(description_ptr description) throw();
69
description_ptr m_description;
73
* Encapsulate a stack of Subversion error codes and messages.
75
class Error : public InternalError
78
Error(const Error& that) throw();
79
Error& operator=(const Error& that) throw();
80
virtual ~Error() throw();
83
* Returns the error code associated with the top-level error that
84
* caused the exception.
86
virtual int code() const throw();
79
89
* Error message description.
81
* The first element of this pair is the error code, the second the
82
* associated error message. If the error code is 0, the message
83
* describes the location in the source code where the error was
86
typedef std::pair<int, std::string> message;
95
* Create a message object given an error code and error message.
97
Message(int errval, const std::string& message)
104
* Create a message object given an error code and error message,
105
* and set the flag that tells if this is a debugging traceback entry.
107
Message(int errval, const std::string& message, bool trace)
114
* Return the error code.
116
int code() const throw() { return m_errno; }
119
* Return the error message.
121
const std::string& message() const throw() { return m_message; }
124
* Return the generic error message associated with the error code.
126
const char* generic_message() const;
129
* Check if this message is in fact a debugging traceback entry.
131
bool trace() const throw() { return m_trace; }
135
std::string m_message;
89
140
* The list of messages associated with an error.
91
typedef std::vector<message> message_list;
142
typedef std::vector<Message> MessageList;
94
145
* Returns the complete list of error messages, including those from
97
virtual message_list messages() const
148
virtual MessageList messages() const
99
150
return compile_messages(false);
106
157
* Traceback is only available if the Subversion libraries were
107
158
* compiled with tracing enabled.
109
virtual message_list traced_messages() const
160
virtual MessageList traced_messages() const
111
162
return compile_messages(true);
115
/** Used internally by the implementation. */
116
static void throw_svn_error(svn_error_t*);
119
error(int error_code, detail::error_description* description) throw();
122
std::vector<message> compile_messages(bool show_traces) const;
124
int m_errno; /**< The (SVN or APR) error code. */
125
shared_ptr m_nested; /**< Optional pointer to nessted error. */
126
/** Error description and trace location information. */
127
detail::error_description* m_description;
166
explicit Error(description_ptr description) throw()
167
: InternalError(description)
169
MessageList compile_messages(bool show_traces) const;
130
class cancelled : public error
173
* Thrown instead of Error when the error chain contains a
174
* @c SVN_ERR_CANCELLED error code.
176
class Cancelled : public Error
132
friend void error::throw_svn_error(svn_error_t*);
135
cancelled(int error_code, detail::error_description* description) throw()
136
: error(error_code, description)
179
explicit Cancelled(description_ptr description) throw()
140
} // namespace version_1_9_dev
141
184
} // namespace cxxhl
142
185
} // namespace subversion
186
} // namespace apache
144
188
#endif // SVN_CXXHL_EXCEPTION_HPP