You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by Stocks Alex <al...@outlook.com> on 2019/06/05 04:28:32 UTC

[DISCUSS] How to handle Java Exception in go

Hello Dubbo/Dubbogo Community,



         In hessian2-go (https://github.com/dubbogo/hessian2<https://github.com/dubbogo/hessian2/issues/53>), we plan to support Java Exception. In hessian2-go, users should use RegisterPOJO/RegisterPOJOs to register a go struct which is matching a JAVA POJO class to parse java class. If not, hessian2-go can not unmarshal the java exception steam bytes from hessian2-java. To handle Java Exception, hessian2-go may be should build some popular Java Exceptions in this repo to help users.

         The problem is that there are som many java exceptions! Our community has built a [issue](https://github.com/dubbogo/hessian2/issues/53) to discuss this topic. And there is no common conclusion now.


         Pls reply this email to get more suggestions if u have a good idea.

Re: [DISCUSS] How to handle Java Exception in go

Posted by Huxing Zhang <hu...@apache.org>.
Hi,

On Wed, Jun 5, 2019 at 12:28 PM Stocks Alex <al...@outlook.com> wrote:
>
> Hello Dubbo/Dubbogo Community,
>
>
>
>          In hessian2-go (https://github.com/dubbogo/hessian2<https://github.com/dubbogo/hessian2/issues/53>), we plan to support Java Exception. In hessian2-go, users should use RegisterPOJO/RegisterPOJOs to register a go struct which is matching a JAVA POJO class to parse java class. If not, hessian2-go can not unmarshal the java exception steam bytes from hessian2-java. To handle Java Exception, hessian2-go may be should build some popular Java Exceptions in this repo to help users.
>
>          The problem is that there are som many java exceptions!

Why not use java.lang.Exception, which is super class of all the other
Exception in Java? I am not very familiar with go, if
java.lang.Excpetion can not be covered,  maybe java.lang.Throwable can
be used as well, which is super class of java.lang.Exception.
There is a field called "detailMessage" in java.lang.Throwable so that
you can put the error message into it.

> Our community has built a [issue](https://github.com/dubbogo/hessian2/issues/53) to discuss this topic. And there is no common conclusion now.
>
>
>          Pls reply this email to get more suggestions if u have a good idea.



-- 
Best Regards!
Huxing