1 /******************************************************************
\r
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 ******************************************************************/
\r
22 * @file RamlExceptions.h
\r
24 * @brief This file provides exception handling while parsing RAML and Json Schema.
\r
27 #ifndef RAML_EXCEPTIONS_H_
\r
28 #define RAML_EXCEPTIONS_H_
\r
30 #include <exception>
\r
31 #include "RamlErrorCodes.h"
\r
32 #include "yaml-cpp/exceptions.h"
\r
37 * @class RamlException
\r
38 * @brief This is the base exception of all type of exception thrown from RamlParser module.
\r
40 class RamlException : public std::exception
\r
44 * Constructor of RamlException.
\r
46 * @param message - String describing the error messsage.
\r
48 RamlException(const std::string &message) : m_message(message) {}
\r
51 * Constructor of RamlException.
\r
53 * @param mark - line and column information of exception thrown.
\r
54 * @param message - String describing the error messsage.
\r
56 RamlException(const YAML::Mark &mark, const std::string &message);
\r
59 * API to get error message describing exception reason.
\r
61 * @return Null terminated string.
\r
63 virtual const char *what() const noexcept;
\r
64 virtual ~RamlException() throw() {}
\r
67 std::string m_message;
\r
72 * @class RamlParserException
\r
73 * @brief This exception will be thrown to indicate Parser Exception.
\r
75 class RamlParserException : public RamlException
\r
79 * Constructor of RamlParserException.
\r
81 * @param message - String describing the error messsage.
\r
83 RamlParserException(const std::string &message): RamlException(message) {}
\r
86 * Constructor of RamlParserException.
\r
88 * @param mark - line and column information of exception thrown.
\r
89 * @param message - String describing the error messsage.
\r
91 RamlParserException(const YAML::Mark &mark, const std::string &message): RamlException(mark,
\r
96 * @class RamlRepresentationException
\r
97 * @brief This exception will be thrown to indicate invalid Raml Representation case.
\r
99 class RamlRepresentationException : public RamlException
\r
103 * Constructor of RamlRepresentationException.
\r
105 * @param message - String describing the error messsage.
\r
107 RamlRepresentationException(const std::string &message): RamlException(message) {}
\r
110 * Constructor of RamlRepresentationException.
\r
112 * @param mark - line and column information of exception thrown.
\r
113 * @param message - String describing the error messsage.
\r
115 RamlRepresentationException(const YAML::Mark &mark, const std::string &message): RamlException(mark,
\r
120 * @class RamlBadFile
\r
121 * @brief This exception will be thrown to indicate RAMl BadFile.
\r
123 class RamlBadFile : public RamlException
\r
127 * Constructor of RamlBadFile.
\r
129 * @param message - String describing the error messsage.
\r
131 RamlBadFile(const std::string &message) : RamlException(message) {}
\r
134 * Constructor of RamlBadFile.
\r
136 * @param mark - line and column information of exception thrown.
\r
137 * @param message - String describing the error messsage.
\r
139 RamlBadFile(const YAML::Mark &mark, const std::string &message): RamlException(mark, message) {}
\r
142 * @class JsonException
\r
143 * @brief This exception will be thrown to indicate invalid Json file.
\r
145 class JsonException : public RamlException
\r
149 * Constructor of JsonException.
\r
151 * @param message - String describing the error messsage.
\r
153 JsonException(const std::string &message) : RamlException(message) {}
\r