All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.prompto.error.ExecutionError.js Maven / Gradle / Ivy

var PromptoError = require("./PromptoError").PromptoError;
var ErrorVariable = require("../runtime/ErrorVariable").ErrorVariable;

function ExecutionError(message) {
	PromptoError.call(this, message);
	return this;
}

ExecutionError.prototype = Object.create(PromptoError.prototype);
ExecutionError.prototype.constructor = ExecutionError;

ExecutionError.prototype.interpret = function(context, errorName) {
    var exp = this.getExpression(context);
    if(exp==null) {
        var args = new ArgumentAssignmentList();
        args.add(new ArgumentAssignment(new UnresolvedArgument("name"), new TextLiteral(this.getType().Name)));
        args.add(new ArgumentAssignment(new UnresolvedArgument("text"), new TextLiteral(this.message)));
        exp = new ConstructorExpression(new CategoryType("Error"), args);
    }
    if(context.getRegisteredValue(errorName)==null)
        context.registerValue(new ErrorVariable(errorName));
    var error = exp.interpret(context);
    context.setValue(errorName, error);
    return error;
};

exports.ExecutionError = ExecutionError;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy