Atitti the translation of cross-language exceptions throws Java JS

Source: Internet
Author: User

Atitti The translation of cross-language exceptions throws Java JS

The conversion of the exception is directly deserialized into the JSON object e object.

Js, there is no complete e- mechanism, you can refer to Java Implementation of a stack hierarchy mechanism of e object can be:

throws runtimeexception vs or e.cause;

The full e should be thrown because Runtimee may have some notes:

How to catch the exception, you can judge, if it is runtimeexception, then capture his cause can be.

function Convert2jsex (data)

{

if (typeof data== "string")

{

try{

data = eval ("(" + Data + ")");

}catch (e)

{

// alert (e);

Yaosh Puton str Zeu return;

if (e instanceof referenceerror)

Return

// return e;

}

}

if (data["@type"]!=null && data["@type"]== "Java.lang.RuntimeException")

  { 

throw data.cause;

}

else if (data["@type"]!=null && data["@type"]== "Java.lang.Exception")

{

Throw data.cause;

}

else if (data["StackTrace"]!=null)

{

throw data;

}

else if (data["Xdebug_message"]!=null)

{

if (data.xdebug_message!=null)

LOGX (data.xdebug_message);

throw data.xdebug_message;

}

Else

return false;

}

author::  Nickname :Old Wow's claws( Full Name::AttilaxAkbar Al Rapanui Attilaksachanui) 

Kanji Name: Etila ( Ayron) , email:[email protected]

reprint Please indicate source: http://www.cnblogs.com/attilax/

Atiend

Atitti the translation of cross-language exceptions throws Java JS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.