package studio.junk.jam.coloritum;

import groovy.lang.Binding;
import groovy.lang.Script;

public abstract class NamedScript extends Script {

	public String scriptName;

	public NamedScript() {}

	public NamedScript(Binding binding) {
		super(binding);
	}

	@Override
	public Object run() {
		try {
			return raw();
		} catch (RuntimeException ex) {
			System.err.println("Exception in " + scriptName);
			ex.printStackTrace();
			return null;
		}

	}

	protected abstract Object raw();

}
