外部库无法捕获的异常

时间:2014-09-18 07:23:12

标签: java exception-handling

我从一个名为runFile的外部库中调用一个函数,它允许我从文件中运行外部脚本。我成功调用了我想用该函数运行的任何脚本,但问题是我不知道如何检测我运行的脚本何时被对话框中的用户中止。

库中函数的描述如下:

String runFile(String sScriptPath)

描述:从文件中运行脚本

参数:sScriptPath文件名,它是完整路径,通配符掩码或只是基本名称,在这种情况下,文件在当前目录中搜索或使用ucam.db键。

返回:如果运行正常则返回字符串RUN_STATUS_OK,否则返回有关遇到的问题的消息。 异常:如果在脚本调用期间遇到任何问题

,则出现AbortException

我的代码如下:

try{
    //Protected code
    RunFileReturn = runFile("C:\\macros\\ucammacros\\Blocs.vhs",[{HabemusRear,bRepetError}]);       
    if(!isEqual(RunFileReturn,"OK"))
    {
        promptStart();  
            promptLabel("");
            promptLabel("Hi ha hagut un error al repassar els pads als blocs.");
            promptLabel("");
            promptLabel("Aborta i recupera el circuit des de l'últim checkpoint.");
        promptEnd();
    }
}catch(AbortException e)
{
    //Catch block
    promptStart();  
        promptLabel("Exception found.");
    promptEnd();
    //do something more

}

有人可以告诉我出了什么问题吗? RunFileReturn总是返回" OK"除非没有这样的文件而且我从未进入过捕获区。

请帮忙!谢谢!

0 个答案:

没有答案
相关问题