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)) {
|
||||
is JsonPackage -> {
|
||||
try {
|
||||
return Gson().fromJson<Array<InternalTexture>>(pkg.content, Array<InternalTexture>::class.java).map {
|
||||
tex -> tex.toTexture()
|
||||
return Gson().fromJson<Array<InternalTexture>>(pkg.content, Array<InternalTexture>::class.java)
|
||||
.map { tex ->
|
||||
tex.toTexture()
|
||||
}.toTypedArray()
|
||||
} catch (e: JsonSyntaxException) {
|
||||
throw ConnectionInvalidJsonException()
|
||||
|
|
|
@ -6,9 +6,11 @@ import java.lang.Exception
|
|||
|
||||
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)
|
||||
}
|
||||
|
||||
class ConnectionUnexpectedPacketException : ConnectionException("Got Unexpected Type of Packet")
|
||||
class ConnectionInvalidJsonException : ConnectionException("The Format of the Json Received is Unexpected.")
|
||||
|
||||
|
|
Loading…
Reference in New Issue