|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
net.scheinerman.phoenix.interpreter.exceptions.PhoenixRuntimeException
public class PhoenixRuntimeException
This is the root of all exceptions that can be thrown during Phoenix program execution. Due to the fact that JBasic
is not compiled, all exceptions that are thrown are RuntimeException
s. This class provides the basic
outline for Phoenix error output. All subclassed exceptions are expected to override the getErrorType()
and getBriefMessage()
methods to provide their own functionality. All exceptions are then to
be caught and the printErrorMessage(String, String, int)
is to be called, followed by a call to
System.exit(int)
. The printErrorMessage(String, String, int)
makes use of the two aforementioned
methods in the print out in the following way:
**************************************************
getErrorType() found in file [file], line [lineN]:
Line: [line]
Error: getErrorMessage()
**************************************************
So for example the result of a call of printErrorMessage("fileName","nuf a = 24df", 2)
on a
JBasicRuntimeException
object would provide the message:
**************************************************
Syntax error found in file test.phx, line 2:
Line: nuf a = 24df
Error: Generic syntax error
**************************************************
Field Summary | |
---|---|
private java.lang.String |
briefMessage
The slightly more descriptive phrase explaining the error. |
private java.lang.String |
errorType
The basic error type of the exception, in this case it is, "Error" . |
private int |
lastLine
|
private boolean |
lastLineSet
|
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
PhoenixRuntimeException()
Default constructor, does nothing. |
|
PhoenixRuntimeException(PhoenixRuntimeException e)
Creates a new PhoenixRuntimException as a copy of another. |
|
PhoenixRuntimeException(java.lang.String errorType,
java.lang.String briefMessage)
|
Method Summary | |
---|---|
java.lang.String |
getBriefMessage()
This returns a brief (one line) description of the error that occurred. |
java.lang.String |
getErrorType()
This method returns the type of error for this particular exception. |
int |
getLastLine()
|
boolean |
isLastLineSet()
|
void |
printErrorMessage()
This prints a standardized error message for this exception based on the results of the
getErrorType() and getBriefMessage() methods. |
void |
setLastLine(int lastLine)
|
void |
setLastLineSet(boolean lastLineSet)
|
Methods inherited from class java.lang.Throwable |
---|
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.lang.String errorType
"Error"
.
private java.lang.String briefMessage
"Generic error"
.
private int lastLine
private boolean lastLineSet
Constructor Detail |
---|
public PhoenixRuntimeException(PhoenixRuntimeException e)
PhoenixRuntimException
as a copy of another.
e
- - The exception to be copied.public PhoenixRuntimeException(java.lang.String errorType, java.lang.String briefMessage)
public PhoenixRuntimeException()
Method Detail |
---|
public java.lang.String getErrorType()
"Syntax error"
.
public java.lang.String getBriefMessage()
"Generic error"
.
public void setLastLine(int lastLine)
public int getLastLine()
public void setLastLineSet(boolean lastLineSet)
public boolean isLastLineSet()
public final void printErrorMessage()
getErrorType()
and getBriefMessage()
methods. This output is thoroughly
described in the class description. The invocation of this method should be followed by a call to
System.exit(int)
.
file
- - the file that this error occurred inline
- - the line that this error occured onlineN
- - the number of the line that this error occured on
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |