ProteoWizard
EnumConstantNotPresentException.hpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Austin Keller <atkeller .@. uw.edu>
6//
7// Licensed under the Apache License, Version 2.0 (the "License");
8// you may not use this file except in compliance with the License.
9// You may obtain a copy of the License at
10//
11// http://www.apache.org/licenses/LICENSE-2.0
12//
13// Unless required by applicable law or agreed to in writing, software
14// distributed under the License is distributed on an "AS IS" BASIS,
15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16// See the License for the specific language governing permissions and
17// limitations under the License.
18//
19
20#ifndef _ENUMCONSTANTNOTPRESENTEXCEPTION_HPP
21#define _ENUMCONSTANTNOTPRESENTEXCEPTION_HPP
22
24
25/// An exception class inspired by Java's EnumConstantNotPresentException.
26class EnumConstantNotPresentException : public std::runtime_error
27{
28public:
29 /// Constructor with string message
30 explicit EnumConstantNotPresentException(const std::string& _Message)
31 : runtime_error(_Message) {}
32
33 /// Constructor with char* message
34 explicit EnumConstantNotPresentException(const char* _Message)
35 : runtime_error(_Message) {}
36
37 /// Required override of destructor for std::exception
39
40 /// Provides descriptive message of error
41 const char* what() const throw() override
42 {
43 return "Attempted to access enum by name that is not present";
44 }
45};
46#endif
An exception class inspired by Java's EnumConstantNotPresentException.
~EnumConstantNotPresentException() override
Required override of destructor for std::exception.
const char * what() const override
Provides descriptive message of error.
EnumConstantNotPresentException(const char *_Message)
Constructor with char* message.
EnumConstantNotPresentException(const std::string &_Message)
Constructor with string message.