package kalang.lang;

import kalang.annotation.Nullable;

/**
 *
 * @author Kason Yang
 */
public abstract class Script {

    public final static int SUCCESS = 0;

    private String[] arguments = new String[0];

    protected abstract void execute();

    public int run() {
        execute();
        return SUCCESS;
    }

    public int run(@Nullable String[] arguments) {
        if (arguments != null) {
            this.arguments = arguments;
        }
        return run();
    }
    
    protected String[] arguments(){
        return this.arguments;
    }

}

@@ -244,16 +244,33 @@
 xecute()
+ throws Throwable
 ;%0A%0A    p
@@ -289,28 +289,134 @@
 n() 
-%7B%0A        execute();
+throws Throwable %7B%0A        try%7B%0A            execute();%0A        %7Dcatch(Throwable e) %7B%0A            handleException(e);%0A        %7D
 %0A   
@@ -491,16 +491,33 @@
 guments)
+ throws Throwable
  %7B%0A     
@@ -699,12 +699,106 @@
 s;%0A    %7D
+%0A    %0A    protected void handleException(Throwable e) throws Throwable%7B%0A        throw e;%0A    %7D
 %0A%0A%7D%0A

add handleException