sry, fix Formating :D
This commit is contained in:
parent
37c4983d8e
commit
c975730a58
@ -80,8 +80,9 @@ 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 -> {
|
is JsonPackage -> {
|
||||||
try {
|
try {
|
||||||
return Gson().fromJson<Array<InternalTexture>>(pkg.content, Array<InternalTexture>::class.java).map {
|
return Gson().fromJson<Array<InternalTexture>>(pkg.content, Array<InternalTexture>::class.java)
|
||||||
tex -> tex.toTexture()
|
.map { tex ->
|
||||||
|
tex.toTexture()
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
} catch (e: JsonSyntaxException) {
|
} catch (e: JsonSyntaxException) {
|
||||||
throw ConnectionInvalidJsonException()
|
throw ConnectionInvalidJsonException()
|
||||||
|
@ -6,9 +6,11 @@ import java.lang.Exception
|
|||||||
|
|
||||||
sealed class ConnectionException(override val message: String) : Exception(message)
|
sealed class ConnectionException(override val message: String) : Exception(message)
|
||||||
|
|
||||||
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 ConnectionUnexpectedPacketException : 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
Block a user