TextureSync/client/src/main/kotlin/org/hso/texturesyncclient/controller/net/error.kt

20 lines
826 B
Kotlin

package org.hso.texturesyncclient.controller.net
import com.google.gson.JsonSyntaxException
import java.lang.Exception
sealed class ConnectionException(val msg : String) : Exception(msg)
class ConnectionErrorException(val error : ErrorPacket) : ConnectionException("${error.code} ${error.message}")
class ConnectionUnexpectedPacket : ConnectionException("Got Unexpected Type of Packet")
class ConnectionInvalidJsonException : ConnectionException("The Format of the Json Received is Unexpected.")
sealed class PacketException(msg: String) : ConnectionException(msg)
class PacketTooLongException : PacketException("The Package is too long.")
class PacketInvalidType : PacketException("The Package has an Invalid Type.")
class PacketInvalidData : PacketException("The Package has an Invalid Data. (e.g. Invalid Json.)")