exceptions.hpp revision 275988
1178479Sjb// Copyright (c) 2007 The NetBSD Foundation, Inc.
2178479Sjb// All rights reserved.
3178479Sjb//
4178479Sjb// Redistribution and use in source and binary forms, with or without
5178479Sjb// modification, are permitted provided that the following conditions
6178479Sjb// are met:
7178479Sjb// 1. Redistributions of source code must retain the above copyright
8178479Sjb//    notice, this list of conditions and the following disclaimer.
9178479Sjb// 2. Redistributions in binary form must reproduce the above copyright
10178479Sjb//    notice, this list of conditions and the following disclaimer in the
11178479Sjb//    documentation and/or other materials provided with the distribution.
12178479Sjb//
13178479Sjb// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
14178479Sjb// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15178479Sjb// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16178479Sjb// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17178479Sjb// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
18178479Sjb// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19178479Sjb// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20178479Sjb// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21178479Sjb// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22178479Sjb// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23178479Sjb// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24178479Sjb// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25178479Sjb
26178479Sjb#if !defined(ATF_CXX_DETAIL_EXCEPTIONS_HPP)
27237624Spfg#define ATF_CXX_DETAIL_EXCEPTIONS_HPP
28267942Srpaulo
29253725Spfg#include <stdexcept>
30237624Spfg#include <string>
31178479Sjb
32178479Sjbextern "C" {
33178479Sjbstruct atf_error;
34178479Sjb}
35178479Sjb
36178479Sjbnamespace atf {
37178479Sjb
38277300Ssmhclass system_error : public std::runtime_error {
39178479Sjb    int m_sys_err;
40178558Sjb    mutable std::string m_message;
41178558Sjb
42211554Srpaulopublic:
43178558Sjb    system_error(const std::string&, const std::string&, int);
44178479Sjb    ~system_error(void) throw();
45178479Sjb
46178479Sjb    int code(void) const throw();
47178479Sjb    const char* what(void) const throw();
48178479Sjb};
49178479Sjb
50178479Sjbvoid throw_atf_error(struct atf_error *);
51178479Sjb
52178479Sjb} // namespace atf
53178479Sjb
54178479Sjb#endif // !defined(ATF_CXX_DETAIL_EXCEPTIONS_HPP)
55178479Sjb