Search in sources :

Example 1 with DieException

use of php.runtime.env.DieException in project jphp by jphp-compiler.

the class ErrorHandler method onError.

public boolean onError(Environment env, SystemMessage message) {
    if (ErrorType.check(errorHandlerFlags, message.getType())) {
        TraceInfo trace = message.getTrace().trace;
        int argCount = invoker.getArgumentCount();
        if (argCount < 4)
            argCount = 4;
        else if (argCount > 5)
            argCount = 5;
        Memory[] args = new Memory[argCount];
        args[0] = LongMemory.valueOf(message.getType().value);
        args[1] = new StringMemory(message.getMessage());
        args[2] = new StringMemory(trace.getFileName());
        args[3] = LongMemory.valueOf(trace.getStartLine() + 1);
        if (argCount > 4)
            args[4] = new ArrayMemory(false, message.getTrace().args);
        try {
            invoker.setTrace(null);
            return (invoker.call(args).toValue() != Memory.FALSE);
        } catch (ErrorException e) {
            throw e;
        } catch (BaseException e) {
            throw e;
        } catch (DieException e) {
            throw e;
        } catch (Throwable throwable) {
            throw new RuntimeException(throwable);
        }
    }
    return false;
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) BaseException(php.runtime.lang.BaseException) Memory(php.runtime.Memory) ArrayMemory(php.runtime.memory.ArrayMemory) LongMemory(php.runtime.memory.LongMemory) StringMemory(php.runtime.memory.StringMemory) DieException(php.runtime.env.DieException) StringMemory(php.runtime.memory.StringMemory) TraceInfo(php.runtime.env.TraceInfo) ErrorException(php.runtime.exceptions.support.ErrorException)

Aggregations

Memory (php.runtime.Memory)1 DieException (php.runtime.env.DieException)1 TraceInfo (php.runtime.env.TraceInfo)1 ErrorException (php.runtime.exceptions.support.ErrorException)1 BaseException (php.runtime.lang.BaseException)1 ArrayMemory (php.runtime.memory.ArrayMemory)1 LongMemory (php.runtime.memory.LongMemory)1 StringMemory (php.runtime.memory.StringMemory)1