1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //    http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #ifndef __EXCEPTIONS_H
17 #define __EXCEPTIONS_H
18 
19 #include <stdexcept>
20 #include "miniz/miniz.h"
21 
22 namespace Exceptions
23 {
24     /**
25     Exception thrown on error in command line parameters
26     */
27     class CmdLineError : public std::runtime_error
28     {
29     public:
CmdLineError(const std::string & msg)30         CmdLineError (const std::string& msg): std::runtime_error(msg){}
31     };
32 
33     /**
34     Exception thrown on error in test run
35     */
36     class TestError : public std::runtime_error
37     {
38     public:
runtime_error(msg)39         TestError (const std::string& msg, int errorCode = 1): std::runtime_error(msg), m_errorCode(errorCode){}
40 
getErrorCode()41         int getErrorCode() const { return m_errorCode; }
42     private:
43         int m_errorCode;
44     };
45 
46     class ArchiveError : public std::runtime_error
47     {
48     public:
ArchiveError(int errCode)49         ArchiveError(int errCode): std::runtime_error(mz_error(errCode)){}
50     };
51 }
52 
53 #endif
54