sry, fix Formating :D

This commit is contained in:
CodeSteak 2019-06-03 16:33:19 +02:00
parent 37c4983d8e
commit c975730a58
2 changed files with 30 additions and 27 deletions

View File

@ -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()

View File

@ -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.")