Search in sources :

Example 1 with SystemMessage

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

the class LangFunctions method error_get_last.

public static Memory error_get_last(Environment env) {
    SystemMessage err = env.getLastMessage();
    if (err == null)
        return Memory.NULL;
    ArrayMemory result = new ArrayMemory();
    result.refOfIndex("type").assign(err.getType().value);
    result.refOfIndex("message").assign(err.getMessage());
    if (err.getTrace() != null && err.getTrace().trace != null) {
        result.refOfIndex("file").assign(err.getTrace().trace.getFileName());
        result.refOfIndex("line").assign(err.getTrace().trace.getStartLine() + 1);
        result.refOfIndex("position").assign(err.getTrace().trace.getStartPosition() + 1);
    }
    return result.toConstant();
}
Also used : ArrayMemory(php.runtime.memory.ArrayMemory) SystemMessage(php.runtime.env.message.SystemMessage)

Aggregations

SystemMessage (php.runtime.env.message.SystemMessage)1 ArrayMemory (php.runtime.memory.ArrayMemory)1