Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * An exception that is thrown when a feature is used outside 11 : : * the logic that cvc5 is currently using (for example, a quantifier 12 : : * is used while running in a quantifier-free logic). 13 : : */ 14 : : 15 : : #include "cvc5_public.h" 16 : : 17 : : #ifndef CVC5__SMT__LOGIC_EXCEPTION_H 18 : : #define CVC5__SMT__LOGIC_EXCEPTION_H 19 : : 20 : : #include "base/exception.h" 21 : : 22 : : namespace cvc5::internal { 23 : : 24 : : class LogicException : public cvc5::internal::Exception 25 : : { 26 : : public: 27 : : LogicException() 28 : : : Exception( 29 : : "Feature used while operating in " 30 : : "incorrect state") 31 : : { 32 : : } 33 : : 34 : 54 : LogicException(const std::string& msg) : Exception(msg) {} 35 : : 36 : 10 : LogicException(const char* msg) : Exception(msg) {} 37 : : }; /* class LogicException */ 38 : : 39 : : /** 40 : : * Prepends a logic exception with the text "Logic restricted in safe mode". 41 : : * This kind of logic exception should be thrown for any failure that is 42 : : * admissible in safe mode. The regression testers will consider any exception 43 : : * having text "in safe mode" as an admissible failure, and skip the benchmark. 44 : : */ 45 : : class SafeLogicException : public LogicException 46 : : { 47 : : public: 48 : 4 : SafeLogicException(const std::string& s) 49 : : #if defined(CVC5_SAFE_MODE) || defined(CVC5_STABLE_MODE) 50 : : : LogicException("Logic restricted in safe mode. " + s) 51 : : #else 52 : 4 : : LogicException(s) 53 : : #endif 54 : : { 55 : 4 : } 56 : : }; 57 : : 58 : : } // namespace cvc5::internal 59 : : 60 : : #endif /* CVC5__SMT__LOGIC_EXCEPTION_H */