sleep.error

Class YourCodeSucksException

public class YourCodeSucksException extends 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

Constructor Summary
YourCodeSucksException(LinkedList myErrors)
Initialize the exception (sleep parser)
Method Summary
StringformatErrors()
generate a nicely formatted string representation of the script errors in this exception
LinkedListgetErrors()
All of the errors are stored in a linked list.
StringgetMessage()
Returns a minimal string representation of the errors within this exception
voidprintErrors(OutputStream out)
print a nicely formatted version of the script errors to the specified stream
StringtoString()
Returns a simple string representation of the errors within this exception

Constructor Detail

YourCodeSucksException

public YourCodeSucksException(LinkedList myErrors)
Initialize the exception (sleep parser)

Method Detail

formatErrors

public String formatErrors()
generate a nicely formatted string representation of the script errors in this exception

getErrors

public LinkedList getErrors()
All of the errors are stored in a linked list. The linked list contains SyntaxError objects.

getMessage

public String getMessage()
Returns a minimal string representation of the errors within this exception

printErrors

public void printErrors(OutputStream out)
print a nicely formatted version of the script errors to the specified stream

toString

public String toString()
Returns a simple string representation of the errors within this exception