DCCL v3
exception.h
1 // Copyright 2009-2017 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2 // GobySoft, LLC (for 2013-)
3 // Massachusetts Institute of Technology (for 2007-2014)
4 // Community contributors (see AUTHORS file)
5 //
6 //
7 // This file is part of the Dynamic Compact Control Language Library
8 // ("DCCL").
9 //
10 // DCCL is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 2.1 of the License, or
13 // (at your option) any later version.
14 //
15 // DCCL is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with DCCL. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef Exception20100812H
23 #define Exception20100812H
24 
25 #include <stdexcept>
26 #include <google/protobuf/descriptor.h>
27 
28 namespace dccl
29 {
31  class Exception : public std::runtime_error {
32  public:
33  Exception(const std::string& s)
34  : std::runtime_error(s)
35  { }
36 
37  };
38 
41  {
42  public:
44  : Exception("NULL Value")
45  { }
46  };
47 
48  class OutOfRangeException : public std::out_of_range
49  {
50  public:
51  OutOfRangeException(const std::string& s, const google::protobuf::FieldDescriptor* field) : std::out_of_range(s), field_(field)
52  { }
53 
54  const google::protobuf::FieldDescriptor* field() const { return field_; }
55 
56  private:
57  const google::protobuf::FieldDescriptor* field_;
58  };
59 }
60 
61 #endif
62 
dccl
Dynamic Compact Control Language namespace.
Definition: gen_units_class_plugin.h:49
dccl::Exception
Exception class for DCCL.
Definition: exception.h:31
dccl::NullValueException
Exception used to signal null (non-existent) value within field codecs during decode.
Definition: exception.h:40
dccl::OutOfRangeException
Definition: exception.h:48