exceptions added
This commit is contained in:
		
							parent
							
								
									52dd9b6adf
								
							
						
					
					
						commit
						5017d958c5
					
				| 
						 | 
					@ -0,0 +1,22 @@
 | 
				
			||||||
 | 
					#include"Exceptions.h"
 | 
				
			||||||
 | 
					BaseException::BaseException(const string& message) {
 | 
				
			||||||
 | 
						this->message = message;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					string InputError::what() const {
 | 
				
			||||||
 | 
						return message;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					InputError::InputError(const string& message) :BaseException(message) {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					string FileError::what() const {
 | 
				
			||||||
 | 
						return message;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					FileError::FileError(const string& message) :BaseException(message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					string IndexError::what() const {
 | 
				
			||||||
 | 
						return message;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					IndexError::IndexError(const string& message) :BaseException(message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					#include<fstream>
 | 
				
			||||||
 | 
					#include<iomanip>
 | 
				
			||||||
 | 
					#include<iostream>
 | 
				
			||||||
 | 
					#include<string>
 | 
				
			||||||
 | 
					#include<vector>
 | 
				
			||||||
 | 
					using namespace std;
 | 
				
			||||||
 | 
					class BaseException {
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						BaseException(const string& message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						virtual string what() const=0;
 | 
				
			||||||
 | 
						string message;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					class InputError :public BaseException {
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						InputError(const string& message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						virtual string what() const;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					class FileError :public BaseException {
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						FileError(const string& message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						virtual string what() const;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					class IndexError :public BaseException {
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						IndexError(const string& message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						virtual string what() const;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
		Loading…
	
		Reference in New Issue