1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
22 * @file simulator_exceptions.h
24 * @brief This file provides exceptions which would be thrown from simualtor module.
28 #ifndef SIMULATOR_EXCEPTIONS_H_
29 #define SIMULATOR_EXCEPTIONS_H_
32 #include "simulator_error_codes.h"
35 * @class SimulatorException
36 * @brief This is the base exception of all type of exception thrown from simulator module.
38 class SimulatorException : public std::exception
42 * Constructor of SimulatorException.
44 * @param errorCode - Error code.
45 * @param message - String describing the error messsage.
47 SimulatorException(SimulatorResult errorCode, const std::string &message);
50 * API to get error message describing exception reason.
52 * @return Null terminated string.
54 virtual const char *what() const noexcept;
57 * API to get error code with which exception is thrown.
59 * @return SimulatorResult - Error code.
61 virtual SimulatorResult code() const;
62 virtual ~SimulatorException() throw() {}
65 SimulatorResult m_errorCode;
66 std::string m_message;
70 * @class InvalidArgsException
71 * @brief This exception will be thrown to indicate invalid arguments case.
73 class InvalidArgsException : public SimulatorException
76 InvalidArgsException(SimulatorResult errorCode, const std::string &message);
80 * @class NoSupportException
81 * @brief This exception will be thrown to indicate not supported operation cases.
83 class NoSupportException : public SimulatorException
86 NoSupportException(const std::string &message);
90 * @class OperationInProgressException
91 * @brief This exception will be thrown to indicate requested operation is not allowed as other operation
92 * is in progress state.
94 class OperationInProgressException : public SimulatorException
97 OperationInProgressException(const std::string &message);