-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
|
||
# project name | ||
project(exception) | ||
|
||
# c++ standard | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED on) | ||
|
||
# define sources to use | ||
set(SRCS Error.hpp Error.cpp) | ||
|
||
# define the binary output | ||
add_library(${PROJECT_NAME} ${SRCS}) | ||
|
||
# expose the headers | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
** EPITECH PROJECT, 2020 | ||
** epitech-indiestudio | ||
** File description: | ||
** Error | ||
*/ | ||
|
||
#include "Error.hpp" | ||
|
||
Error::Error(const std::string &msg = "") | ||
{ | ||
_error_msg = msg; | ||
} | ||
|
||
const char *Error::what() const throw() | ||
{ | ||
return _error_msg.c_str(); | ||
} | ||
|
||
StorageError::StorageError(const std::string &msg = "") : Error(msg) | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
** EPITECH PROJECT, 2020 | ||
** epitech-indiestudio | ||
** File description: | ||
** Exception | ||
*/ | ||
|
||
#ifndef EXCEPTION_HPP_ | ||
#define EXCEPTION_HPP_ | ||
|
||
#include <exception> | ||
#include <string> | ||
|
||
class Error : public std::exception { | ||
public: | ||
Error(const std::string &msg); | ||
virtual ~Error() throw() {} | ||
virtual const char *what() const throw(); | ||
protected: | ||
std::string _error_msg; | ||
}; | ||
|
||
class StorageError : public Error | ||
{ | ||
public: | ||
StorageError(const std::string &msg); | ||
virtual ~StorageError() throw(){} | ||
}; | ||
|
||
#endif /* !EXCEPTION_HPP_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters