Commit fea0dbba authored by Алина Орехова's avatar Алина Орехова
Browse files

Add new file

parent d78b4385
No related merge requests found
Pipeline #658 canceled with stages
Showing with 37 additions and 0 deletions
+37 -0
exception.h 0 → 100644
#ifndef LABORATORY_WORK_1_2_EXCEPTIONS_H
#define LABORATORY_WORK_1_2_EXCEPTIONS_H
#include <exception>
#include <string>
class BadFileFormatException : public std::exception {
std::string error;
public:
BadFileFormatException() {
error.assign("Unknown or unsupported file format!");
}
explicit BadFileFormatException(const std::string& file_format) {
error.assign("File format \"" + file_format + "\" is not supported!");
}
const char* what() const noexcept override {
return error.c_str();
}
};
class NoFileFoundException : public std::exception {
std::string error;
public:
NoFileFoundException() {
error.assign("Cannot open file! Probably it does not exist!");
}
explicit NoFileFoundException(const std::string& file_) {
error.assign("Cannot open file: \"" + file_ + "\"! Probably it does not exist!");
}
const char* what() const noexcept override {
return error.c_str();
}
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment