I write a custom Exception
class ConnectionException(reason: String) : KtproxyException(reason)
and the KtproxyException is based on Throwable
.
then I write a function
@Throws(ConnectionException::class, IOException::class)
override suspend fun write(data: ByteArray) {
if (isClosed) throw ConnectionException("connection is closed")
val cipher = encryptCipher.encrypt(data)
val frame = Frame(FrameType.CLIENT, FrameContentType.BINARY, cipher)
proxySocketChannel.aWrite(ByteBuffer.wrap(frame.frameByteArray))
}
When I write codes in idea ue 2017.3.4, I type Ctrl + Q
and it says my function will only throw IOException.
I wonder it’s a bug of kotlin or idea ue.