fix: app crash when longClick throws exception

This commit is contained in:
hyb1996
2018-01-04 21:13:12 +08:00
parent 2d287f720c
commit a51b9c24ed
11 changed files with 120 additions and 61 deletions

View File

@@ -10,10 +10,6 @@ var importClass = function(pack){
}
}
var loadJar = function(path){
__runtime__.loadJar(path);
}
__runtime__.bridges.setBridges({
call: function(func, target, args){
var arr = [];
@@ -59,7 +55,24 @@ var __asGlobal__ = function(obj, functions){
}
}
require("__general__")(__runtime__, this);
var __exitIfError__ = function(action, defReturnValue){
try{
return action();
}catch(err){
log(err.toString());
if(err instanceof java.lang.Throwable){
exit(err);
}else if(err instanceof Error){
exit(new org.mozilla.javascript.EvaluatorException(err.name + ": " + err.message, err.fileName, err.lineNumber));
//new java.lang.RuntimeException(err.name + ": " + err.message + "\n" + err.stack));
}else{
exit();
}
return defReturnValue;
}
};
require("__globals__")(__runtime__, this);
(function(scope){