标签:style blog http io ar color os sp java
Atitit.js javascript异常处理机制与java异常的转换.js exception process Voae
Throw str
Not throw error ..cause ie,ff error obj is diff..
不个java异常转换成个js异常走ok...
dwr中看见了dwr的异常转换,三,不生效...只好输出str来转换...
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
elmtC.fileChangeEvent($("#filePath").val(),function(data)
{
processJavaEX(data);
var plt_s=secs2str(data.Duration);
$(‘#playtime‘).timespinner(‘setValue‘,plt_s);
});
if (NoSetAwd(activityId)) {
RuntimeException e=new RuntimeException("e:noSetAwdErr此活动还没设置奖品哟.");
String s= JSONObject.toJSONString(e);
return s;
}
//{"@type":"java.lang.RuntimeException","localizedMessage":"e:noSetAwdErr 此活动还没设置奖品哟.","message":"e:noSetAwdErr此活动还没设置奖品哟.","stackTrace": [{"className":"com.focustar.servlet.AwardServlet","fileName":"AwardServlet.java","lineNumber":132,"methodName":"main","nativeMethod":false}],"suppressed":[]}
function logx(msg) {
try {
console.info("----------from logx");
console.info("--"+msg);
} catch (e) {
// not support console method (ex: IE)
}
}
function processJavaEX(data)
{
if(typeof data=="string")
data = eval( "(" + data + ")" );
if(data["@type"]!=null && data["@type"]=="java.lang.RuntimeException")
{
if(data.message!=null)
logx(data.message);
throw data.message;
}
if(data["stackTrace"]!=null)
{
if(data.message!=null)
logx(data.message);
throw data.message;
}
else
return false;
}
参考
Atititjs javascript异常处理机制与java异常的转换.js exception process - attilax的专栏 - 博客频道 - CSDN.NET.htm
Atitit.js javascript异常处理机制与java异常的转换.js exception process Voae
标签:style blog http io ar color os sp java
原文地址:http://blog.csdn.net/attilax/article/details/41293063