edu.princeton.toy.lang
public interface TExceptionHandler
Modifier and Type | Field and Description |
---|---|
static TExceptionHandler |
PROMISCUOUS_EXCEPTION_HANDLER
An implementation of TExceptionHandler which ignores all exceptions.
|
static TExceptionHandler |
PRUDISH_EXCEPTION_HANDLER
An implementation of TExceptionHandler which throws all exceptions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getWillThrow(int index)
Gets wheter or not the handler should throw a raised exception of the specified type.
|
boolean |
getWillThrow(TExceptionType type)
Gets wheter or not the handler should throw a raised exception of the specified type.
|
void |
raise(TExceptionType type)
Throws a TException with the specified type iff the specified exception was not set to be
ignored.
|
static final TExceptionHandler PROMISCUOUS_EXCEPTION_HANDLER
static final TExceptionHandler PRUDISH_EXCEPTION_HANDLER
void raise(TExceptionType type) throws TException
type
- The type of exceptional condition that was raised in the Virtual Machine.TException
boolean getWillThrow(int index)
index
- The index of type (in the TExceptionType.TYPES array) in question. An invalid
value will result in an ArrayIndexOutOfBoundsException.TExceptionType.TYPES
boolean getWillThrow(TExceptionType type)
type
- The type in question. A null value will result in a NullPointerException.TExceptionType.TYPES