Package sleep.error
Class YourCodeSucksException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- sleep.error.YourCodeSucksException
-
- All Implemented Interfaces:
java.io.Serializable
public class YourCodeSucksException extends java.lang.RuntimeException
Syntax errors are a reality of programming. Any time a syntax error occurs when attempting to load a script the exception YourCodeSucksException will be raised. [ yes, this exception name is staying ]
To catch a YourCodeSucksException:
try { ScriptInstance script; script = loader.loadScript("name", inputStream); } catch (YourCodeSucksException ex) { Iterator i = ex.getErrors().iterator(); while (i.hasNext()) { SyntaxError error = (SyntaxError)i.next(); String description = error.getDescription(); String code = error.getCodeSnippet(); int lineNumber = error.getLineNumber(); } }
- See Also:
SyntaxError
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description YourCodeSucksException(java.util.LinkedList myErrors)
Initialize the exception (sleep parser)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
formatErrors()
generate a nicely formatted string representation of the script errors in this exceptionjava.util.LinkedList
getErrors()
All of the errors are stored in a linked list.java.lang.String
getMessage()
Returns a minimal string representation of the errors within this exceptionvoid
printErrors(java.io.OutputStream out)
print a nicely formatted version of the script errors to the specified streamjava.lang.String
toString()
Returns a simple string representation of the errors within this exception
-
-
-
Method Detail
-
getMessage
public java.lang.String getMessage()
Returns a minimal string representation of the errors within this exception- Overrides:
getMessage
in classjava.lang.Throwable
-
toString
public java.lang.String toString()
Returns a simple string representation of the errors within this exception- Overrides:
toString
in classjava.lang.Throwable
-
printErrors
public void printErrors(java.io.OutputStream out)
print a nicely formatted version of the script errors to the specified stream
-
formatErrors
public java.lang.String formatErrors()
generate a nicely formatted string representation of the script errors in this exception
-
getErrors
public java.util.LinkedList getErrors()
All of the errors are stored in a linked list. The linked list containsSyntaxError
objects.
-
-