|
| 1 | +/* |
| 2 | +This project, FPGA Crypto Service Server, is licensed as below |
| 3 | +
|
| 4 | +*************************************************************************** |
| 5 | +
|
| 6 | +Copyright 2020-2025 Altera Corporation. All Rights Reserved. |
| 7 | +
|
| 8 | +Redistribution and use in source and binary forms, with or without |
| 9 | +modification, are permitted provided that the following conditions are met: |
| 10 | +
|
| 11 | +1. Redistributions of source code must retain the above copyright notice, |
| 12 | +this list of conditions and the following disclaimer. |
| 13 | +
|
| 14 | +2. Redistributions in binary form must reproduce the above copyright |
| 15 | +notice, this list of conditions and the following disclaimer in the |
| 16 | +documentation and/or other materials provided with the distribution. |
| 17 | +
|
| 18 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 21 | +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
| 22 | +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 23 | +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 24 | +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 25 | +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 26 | +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 27 | +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 28 | +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | +
|
| 30 | +*************************************************************************** |
| 31 | +*/ |
| 32 | +#ifndef FCS_EXCEPTION_H |
| 33 | +#define FCS_EXCEPTION_H |
| 34 | + |
| 35 | +#include <exception> |
| 36 | +#include <system_error> |
| 37 | +#include <string> |
| 38 | + |
| 39 | +class FcsException : public std::exception { |
| 40 | +protected: |
| 41 | + std::string msg; |
| 42 | + |
| 43 | +public: |
| 44 | + const char* what() const noexcept override { |
| 45 | + return msg.c_str(); |
| 46 | + } |
| 47 | +}; |
| 48 | + |
| 49 | +class FcsLibraryException : public FcsException { |
| 50 | +protected: |
| 51 | + std::string msg; |
| 52 | + |
| 53 | +public: |
| 54 | + const char* what() const noexcept override { |
| 55 | + return msg.c_str(); |
| 56 | + } |
| 57 | +}; |
| 58 | + |
| 59 | +class FcsLibraryNotFoundException : public FcsLibraryException { |
| 60 | +public: |
| 61 | + explicit FcsLibraryNotFoundException (const char* errorMsg) { |
| 62 | + msg = errorMsg; |
| 63 | + } |
| 64 | +}; |
| 65 | + |
| 66 | +class FcsLibraryFailedToInitializeException : public FcsLibraryException { |
| 67 | +public: |
| 68 | + explicit FcsLibraryFailedToInitializeException (const char* errorMsg) { |
| 69 | + msg = errorMsg; |
| 70 | + } |
| 71 | +}; |
| 72 | + |
| 73 | +#endif //FCS_EXCEPTION_H |
0 commit comments