Allow some exceptions to be handled
This commit is contained in:
20 files changed
+283
-78
No files matched your search
@@ -1,5 +1,8 @@
|
||||
package carpet.script.exception;
|
||||
|
||||
import carpet.script.Context;
|
||||
import carpet.script.Expression;
|
||||
import carpet.script.Tokenizer;
|
||||
import carpet.script.value.FunctionValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -13,4 +16,20 @@ public class InternalExpressionException extends RuntimeException
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Promotes this simple exception into one with context and extra information.
|
||||
*
|
||||
* <p>Provides a cleaner way of handling similar exceptions, in this case
|
||||
* {@link InternalExpressionException} and {@link ThrowStatement}
|
||||
* @param c Context
|
||||
* @param e Expression
|
||||
* @param token Token
|
||||
* @return The new {@link ExpressionException} (or {@link ProcessedThrowStatement}),
|
||||
* depending on the implementation.
|
||||
*/
|
||||
public ExpressionException promote(Context c, Expression e, Tokenizer.Token token)
|
||||
{
|
||||
return new ExpressionException(c, e, token, getMessage(), stack);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user