kitex-contrib / codec-dubbo

支持 kitex <-> dubbo 互通的 dubbo 协议编解码器。
Apache License 2.0
16 stars 14 forks source link

[P1] Proposal: better unwrapping of java exception #66

Closed felix021 closed 7 months ago

felix021 commented 9 months ago

DubboCodec should already be able to decode the exception thrown by dubbo-java, but currently the called may not be able to retrieve it since we it's dumped into a string and returned:

return fmt.Errorf("dubbo side exception: %v", exception)

A better approach is to return a special kind of error which wraps the Exception type.

type DubboError struct {
    exception interface{}
}

func (e *DubboError) Error() string {
    ...
}

func (e *DubboError) Exception() interface{} {
    return e.exception
}
DMwangnima commented 7 months ago

Done by #74.