-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.cpp
More file actions
37 lines (29 loc) · 1005 Bytes
/
exceptions.cpp
File metadata and controls
37 lines (29 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "exceptions.h"
#include <iostream>
//fuction for handling File not found exceptions
FileNotFoundException::FileNotFoundException(std::string fileName) {
this->fileName = fileName;
}
std::string FileNotFoundException::getFileName() {
return fileName;
}
//fuction for handling lexical exceptions
LexicalException::LexicalException(int lineNumber, int linePointer, std::string line, std::string message) {
this->lineNumber = lineNumber; // line number of code where an error is encountered
this->linePointer = linePointer; // index of a character which caused the error
this->message = message; // error message
this->line = line; //error line
}
//respective constructors
int LexicalException::getLineNumber() {
return lineNumber;
}
int LexicalException::getLinePointer() {
return linePointer;
}
std::string LexicalException::getMessage() {
return message;
}
std::string LexicalException::getLine() {
return line;
}