-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathError.java
39 lines (34 loc) · 1009 Bytes
/
Error.java
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
38
39
/*
Class: CS 4308 Section 03
Term: Fall 2021
Name: Faith Swetnam
Instructor: Sharon Perry
Project: Deliverable 1 Scanner
*/
//Class to store error objects
//An error object stores an error message, the value that caused the error (if applicable) and the line the error
//occurred on
public class Error {
private String msg = "";
private String value = null;
private int line = 0;
//Error object if value is available
Error(String msg, String value, int line){
this.msg = msg;
this.value = value;
this.line = line;
}
//Error object if value unavailable
Error(String msg, int line){
this.msg = msg;
this.line = line;
}
//Error object if no value or line if specified
Error(String msg){
this.msg = msg;
}
//Prints the error object values out
void printError(){
System.out.printf("%-50s\t%-10s\t%-10d\n",msg, value, line);
}
}