You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zhangfei9734 (GitHub)" <gi...@apache.org> on 2019/03/01 12:23:43 UTC

[GitHub] [incubator-dubbo] zhangfei9734 opened issue #3587: Not compatible with Kotlin's unchecked exception?

### Environment

* Dubbo version: xxx
* Operating System version: Mac OS X 10.14.3
* Java version: 1.8.0_202

### Steps to reproduce this issue

1. Kotlin integrated dubbo provider throws custom exceptions
![image](https://user-images.githubusercontent.com/16345433/53637218-8d31ff80-3c5d-11e9-8005-1151c3b4cde1.png)
2. 由于Kotlin中没有受检的异常

```kotlin
// provider impl
fun createUser(user: User):User {
  // ...
  if(user.exited) {
    throws CustomException("user exited")
  }
  // ...
}

// consumer
try {
   userService.createUser(user)
} catch (ex: Exception) {
  logger.debug(ex) { "${ex.javaClass}" } // expected CustomException,actual UndeclaredThrowableException
}
```
```java
java.lang.reflect.UndeclaredThrowableException: null
	at com.sun.proxy.$Proxy120.signup(Unknown Source) ~[na:na]
```
Since I am using kotlin, all can't declare an exception on the interface method like java. I tried kotlin to call java method and declare @Thtows(CustomException::class), this can't solve my problem.


[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3587 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] mercyblitz commented on issue #3587: Not compatible with Kotlin's unchecked exception?

Posted by "mercyblitz (GitHub)" <gi...@apache.org>.
It's an issue on Dubbo 2.6.5, please wait for 2.6.6 release to resolve this problem.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3587 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] mercyblitz commented on issue #3587: Not compatible with Kotlin's unchecked exception?

Posted by "mercyblitz (GitHub)" <gi...@apache.org>.
It's an issue on Dubbo 2.6.5, please wait for 2.6.6 to resolve this problem.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3587 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org