fix Typo in 'ConnectionUnexpectedPacketException'
This commit is contained in:
parent
67401817a0
commit
37c4983d8e
|
@ -51,7 +51,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
|
|
||||||
when (val pkg = Package.read(io.first)) {
|
when (val pkg = Package.read(io.first)) {
|
||||||
is JsonPackage -> return
|
is JsonPackage -> return
|
||||||
is BinaryPackage -> throw ConnectionUnexpecedPacketException()
|
is BinaryPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
throw ConnectionInvalidJsonException()
|
throw ConnectionInvalidJsonException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is BinaryPackage -> throw ConnectionUnexpecedPacketException()
|
is BinaryPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is BinaryPackage -> throw ConnectionUnexpecedPacketException()
|
is BinaryPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is BinaryPackage -> throw ConnectionUnexpecedPacketException()
|
is BinaryPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
JsonPackage(obj).write(io.second)
|
JsonPackage(obj).write(io.second)
|
||||||
|
|
||||||
when (val pkg = Package.read(io.first)) {
|
when (val pkg = Package.read(io.first)) {
|
||||||
is JsonPackage -> throw ConnectionUnexpecedPacketException()
|
is JsonPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is BinaryPackage -> return pkg.content
|
is BinaryPackage -> return pkg.content
|
||||||
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
|
@ -206,7 +206,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
JsonPackage(obj).write(io.second)
|
JsonPackage(obj).write(io.second)
|
||||||
|
|
||||||
when (val pkg = Package.read(io.first)) {
|
when (val pkg = Package.read(io.first)) {
|
||||||
is JsonPackage -> throw ConnectionUnexpecedPacketException()
|
is JsonPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is BinaryPackage -> {
|
is BinaryPackage -> {
|
||||||
return Image(ByteArrayInputStream(pkg.content))
|
return Image(ByteArrayInputStream(pkg.content))
|
||||||
}
|
}
|
||||||
|
@ -252,10 +252,10 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
is JsonPackage -> {
|
is JsonPackage -> {
|
||||||
if(ipkg.content != JsonPrimitive(true)) {
|
if(ipkg.content != JsonPrimitive(true)) {
|
||||||
// Protokoll Assertion failed
|
// Protokoll Assertion failed
|
||||||
throw ConnectionUnexpecedPacketException()
|
throw ConnectionUnexpectedPacketException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is BinaryPackage -> throw ConnectionUnexpecedPacketException()
|
is BinaryPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is ErrorPackage -> throw ConnectionErrorException(ipkg)
|
is ErrorPackage -> throw ConnectionErrorException(ipkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
|
||||||
throw IllegalArgumentException("Image Argument was needed.")
|
throw IllegalArgumentException("Image Argument was needed.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is BinaryPackage -> throw ConnectionUnexpecedPacketException()
|
is BinaryPackage -> throw ConnectionUnexpectedPacketException()
|
||||||
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
is ErrorPackage -> throw ConnectionErrorException(pkg)
|
||||||
else -> throw RuntimeException("Unreachable")
|
else -> throw RuntimeException("Unreachable")
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ sealed class ConnectionException(override val message : String) : Exception(mess
|
||||||
class ConnectionErrorException(val errorCode : Int, val errorMessage : String) : ConnectionException("${errorCode} ${errorMessage}") {
|
class ConnectionErrorException(val errorCode : Int, val errorMessage : String) : ConnectionException("${errorCode} ${errorMessage}") {
|
||||||
internal constructor(err : ErrorPackage) : this(err.code, err.message)
|
internal constructor(err : ErrorPackage) : this(err.code, err.message)
|
||||||
}
|
}
|
||||||
class ConnectionUnexpecedPacketException : ConnectionException("Got Unexpected Type of Packet")
|
class ConnectionUnexpectedPacketException : ConnectionException("Got Unexpected Type of Packet")
|
||||||
class ConnectionInvalidJsonException : ConnectionException("The Format of the Json Received is Unexpected.")
|
class ConnectionInvalidJsonException : ConnectionException("The Format of the Json Received is Unexpected.")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue