GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/options/option_exception.h Lines: 6 6 100.0 %
Date: 2021-03-22 Branches: 2 4 50.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file option_exception.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Morgan Deters, Andres Noetzli, Mathias Preiner
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 ** in the top-level source directory and their institutional affiliations.
9
 ** All rights reserved.  See the file COPYING in the top-level source
10
 ** directory for licensing information.\endverbatim
11
 **
12
 ** \brief Options-related exceptions
13
 **
14
 ** Options-related exceptions.
15
 **/
16
17
#include "cvc4_public.h"
18
19
#ifndef CVC4__OPTION_EXCEPTION_H
20
#define CVC4__OPTION_EXCEPTION_H
21
22
#include "base/exception.h"
23
#include "cvc4_export.h"
24
25
namespace CVC4 {
26
27
/**
28
 * Class representing an option-parsing exception such as badly-typed
29
 * or missing arguments, arguments out of bounds, etc.  If an option
30
 * name is itself unrecognized, a UnrecognizedOptionException (a derived
31
 * class, below) should be used instead.
32
 */
33
5
class CVC4_EXPORT OptionException : public CVC4::Exception
34
{
35
 public:
36
5
  OptionException(const std::string& s) : CVC4::Exception(s_errPrefix + s) {}
37
38
  /**
39
   * Get the error message without the prefix that is automatically added for
40
   * OptionExceptions.
41
   */
42
  std::string getRawMessage() const
43
  {
44
    return getMessage().substr(s_errPrefix.size());
45
  }
46
47
 private:
48
  /** The string to be added in front of the actual error message */
49
  static const std::string s_errPrefix;
50
}; /* class OptionException */
51
52
/**
53
 * Class representing an exception in option processing due to an
54
 * unrecognized or unsupported option key.
55
 */
56
2
class UnrecognizedOptionException : public CVC4::OptionException
57
{
58
 public:
59
  UnrecognizedOptionException() :
60
    CVC4::OptionException("Unrecognized informational or option key or setting") {
61
  }
62
63
2
  UnrecognizedOptionException(const std::string& msg) :
64
2
    CVC4::OptionException("Unrecognized informational or option key or setting: " + msg) {
65
2
  }
66
}; /* class UnrecognizedOptionException */
67
68
}/* CVC4 namespace */
69
70
#endif /* CVC4__OPTION_EXCEPTION_H */