GEOS
GeosExceptions.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
22 
23 namespace geos
24 {
25 
29 struct Exception : public std::exception
30 {
31 public:
32  Exception() = default;
33 
39  std::exception( )
40  { m_cachedWhat = what; }
41 
48  virtual char const * what() const noexcept override final
49  { return m_cachedWhat.c_str(); }
50 
55  void prepareWhat( DiagnosticMsg & msg ) noexcept;
56 
57 private:
59  string m_cachedWhat;
60  thread_local static std::ostringstream m_formattingOSS;
61 };
62 
67 {
73  geos::Exception( what )
74  {}
75 
77 };
78 
82 struct LogicError : public geos::Exception
83 {
89  geos::Exception( what )
90  {}
91 
96 };
97 
103 {
109  geos::Exception( what )
110  {}
111 
116 };
121 {
127  geos::Exception( what )
128  {}
129 
134 
139  InputError( char const * const what ):
140  geos::Exception( what )
141  {}
142 
148  InputError( std::exception const & subException, std::string const & msgToInsert );
149 };
150 
155 {
161  geos::Exception( what )
162  {}
163 
168 
173  SimulationError( char const * const what ):
174  geos::Exception( what )
175  {}
176 
183  SimulationError( std::exception const & subException, std::string const & msgToInsert );
184 };
185 
193 {
199  geos::Exception( what )
200  {}
201 
206 };
207 
212 {};
213 
214 }
This file provides the infrastructure to capture external errors.
Exception class used for special control flow.
std::string string
String type.
Definition: DataTypes.hpp:90
Exception class used to report errors from type conversion.
BadTypeError()
Default constructor.
BadTypeError(std::string const &what)
Constructor.
Struct to construct the diagnostic message object.
Exception class used to report domain errors. Generally, the domain of a mathematical function is the...
DomainError(std::string const &what)
Constructor.
DomainError()
Default constructor.
Geos Exception used in GEOS_THROW.
virtual char const * what() const noexcept override final
System fallback to get description content if error system does not achieve to output the ErrorMsg ca...
void prepareWhat(DiagnosticMsg &msg) noexcept
Prepare and cache the formatted exception message.
Exception(std::string const &what)
Constructor.
Exception class used to report errors in user input.
InputError(char const *const what)
Constructor.
InputError()
Default constructor.
InputError(std::exception const &subException, std::string const &msgToInsert)
Constructs an InputError from an underlying exception.
InputError(std::string const &what)
Constructor.
Exception class used to report bad GEOS state.
LogicError(std::string const &what)
Constructor.
LogicError()
Default constructor.
Exception class used to report errors in user input.
RuntimeError(std::string const &what)
Constructor.
Exception class used to report errors related to the simulation.
SimulationError()
Default constructor.
SimulationError(std::exception const &subException, std::string const &msgToInsert)
Construct a SimulationError from an underlying exception.
SimulationError(std::string const &what)
Constructor.
SimulationError(char const *const what)
Constructor.