1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6 
7 // This file was modified by Oracle on 2015.
8 // Modifications copyright (c) 2015 Oracle and/or its affiliates.
9 
10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18 
19 #ifndef BOOST_GEOMETRY_CORE_EXCEPTION_HPP
20 #define BOOST_GEOMETRY_CORE_EXCEPTION_HPP
21 
22 #include <exception>
23 
24 namespace boost { namespace geometry
25 {
26 
27 /*!
28 \brief Base exception class for Boost.Geometry algorithms
29 \ingroup core
30 \details This class is never thrown. All exceptions thrown in Boost.Geometry
31     are derived from exception, so it might be convenient to catch it.
32 */
33 class exception : public std::exception
34 {
what() const35     virtual char const* what() const throw()
36     {
37         return "Boost.Geometry exception";
38     }
39 };
40 
41 /*!
42 \brief Invalid Input Exception
43 \ingroup core
44 \details The invalid_input_exception is thrown if an invalid attribute
45          is passed into a function, e.g. a DE-9IM mask string code containing
46          invalid characters passed into a de9im::mask constructor.
47  */
48 class invalid_input_exception : public geometry::exception
49 {
50 public:
51 
invalid_input_exception()52     inline invalid_input_exception() {}
53 
what() const54     virtual char const* what() const throw()
55     {
56         return "Boost.Geometry Invalid-Input exception";
57     }
58 };
59 
60 /*!
61 \brief Empty Input Exception
62 \ingroup core
63 \details The empty_input_exception is thrown if free functions, e.g. distance,
64     are called with empty geometries, e.g. a linestring
65     without points, a polygon without points, an empty multi-geometry.
66 \qbk{
67 [heading See also]
68 \* [link geometry.reference.algorithms.area the area function]
69 \* [link geometry.reference.algorithms.distance the distance function]
70 \* [link geometry.reference.algorithms.length the length function]
71 }
72  */
73 class empty_input_exception : public geometry::invalid_input_exception
74 {
75 public:
76 
empty_input_exception()77     inline empty_input_exception() {}
78 
what() const79     virtual char const* what() const throw()
80     {
81         return "Boost.Geometry Empty-Input exception";
82     }
83 };
84 
85 
86 }} // namespace boost::geometry
87 
88 #endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP
89