diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/InternalDriverException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/InternalDriverException.kt new file mode 100644 index 0000000..45feebc --- /dev/null +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/InternalDriverException.kt @@ -0,0 +1,23 @@ +package ru.landgrafhomyak.db.skeleton1.api.errors + +import kotlinx.coroutines.CopyableThrowable +import kotlinx.coroutines.ExperimentalCoroutinesApi +import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi + +@OptIn(ExperimentalCoroutinesApi::class) +@ReflectionApi +public open class InternalDriverException : RuntimeException, CopyableThrowable { + public constructor() : super() + public constructor(message: String) : super(message) + public constructor(message: String, cause: Throwable) : super(message, cause) + public constructor(cause: Throwable) : super(cause) + public constructor(message: String?, cause: Throwable?, @Suppress("unused", "LocalVariableName") _marker: Unit) : super(message, cause) + + + override fun createCopy(): InternalDriverException? { + if (this::class !== InternalDriverException::class) + return null + + return InternalDriverException(this.message, this.cause, Unit) + } +} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/SchemaDefinitionException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/SchemaDefinitionException.kt index d8809ba..19bbda0 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/SchemaDefinitionException.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/SchemaDefinitionException.kt @@ -1,12 +1,22 @@ package ru.landgrafhomyak.db.skeleton1.api.errors +import kotlinx.coroutines.CopyableThrowable +import kotlinx.coroutines.ExperimentalCoroutinesApi import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi +@OptIn(ExperimentalCoroutinesApi::class) @ReflectionApi -public abstract class SchemaDefinitionException : RuntimeException { +public open class SchemaDefinitionException : RuntimeException, CopyableThrowable { public constructor() : super() public constructor(message: String) : super(message) public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(cause: Throwable) : super(cause) public constructor(message: String?, cause: Throwable?, @Suppress("unused", "LocalVariableName") _marker: Unit) : super(message, cause) + + override fun createCopy(): SchemaDefinitionException? { + if (this::class !== SchemaDefinitionException::class) + return null + + return SchemaDefinitionException(this.message, this.cause, Unit) + } } \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/EntityNotImplementedException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/EntityNotImplementedException.kt deleted file mode 100644 index b7dea6a..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/EntityNotImplementedException.kt +++ /dev/null @@ -1,61 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.DriverMetainfo -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class EntityNotImplementedException : SchemaDefinitionException, CopyableThrowable { - public val provider: Any - public val driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *> - - public constructor(provider: Any, driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *>) : super(formatMessage(provider, driver)) { - this.provider = provider - this.driver = driver - } - - public constructor(provider: Any, driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *>, customMessage: String) : super(customMessage) { - this.provider = provider - this.driver = driver - } - - public constructor(provider: Any, driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *>, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.provider = provider - this.driver = driver - } - - public constructor(provider: Any, driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *>, cause: Throwable) : super(formatMessage(provider, driver), cause) { - this.provider = provider - this.driver = driver - } - - public constructor( - provider: Any, driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *>, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.provider = provider - this.driver = driver - } - - override fun createCopy(): EntityNotImplementedException? { - return EntityNotImplementedException( - provider = this.provider, - driver = this.driver, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - provider: Any, driver: DriverMetainfo<*, *, *, *, *, *, *, *, *, *> - ): String = "$provider doesn't provides implementation for driver $driver" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/ExportedEntitiesNotImportedException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/ExportedEntitiesNotImportedException.kt deleted file mode 100644 index e85419a..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/ExportedEntitiesNotImportedException.kt +++ /dev/null @@ -1,60 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class ExportedEntitiesNotImportedException : SchemaDefinitionException, CopyableThrowable { - public val sourceScope: Any - public val entities: Collection - - public constructor(sourceScope: Any, entities: Collection) : super(formatMessage(sourceScope, entities)) { - this.sourceScope = sourceScope - this.entities = entities - } - - public constructor(sourceScope: Any, entities: Collection, customMessage: String) : super(customMessage) { - this.sourceScope = sourceScope - this.entities = entities - } - - public constructor(sourceScope: Any, entities: Collection, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.sourceScope = sourceScope - this.entities = entities - } - - public constructor(sourceScope: Any, entities: Collection, cause: Throwable) : super(formatMessage(sourceScope, entities), cause) { - this.sourceScope = sourceScope - this.entities = entities - } - - public constructor( - sourceScope: Any, entities: Collection, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.sourceScope = sourceScope - this.entities = entities - } - - override fun createCopy(): ExportedEntitiesNotImportedException? { - return ExportedEntitiesNotImportedException( - sourceScope = this.sourceScope, - entities = this.entities, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - sourceScope: Any, entities: Collection, - ): String = "Entities exported from $sourceScope wasn't imported to any other scope: ${entities.joinToString()}" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/IncorrectNameException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/IncorrectNameException.kt deleted file mode 100644 index 6d0d568..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/IncorrectNameException.kt +++ /dev/null @@ -1,47 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class IncorrectNameException : SchemaDefinitionException, CopyableThrowable { - public val name: String - - public constructor(name: String) : super(name) { - this.name = name - } - - public constructor(name: String, customMessage: String) : super(customMessage) { - this.name = name - } - - public constructor(name: String, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.name = name - } - - public constructor(name: String, cause: Throwable) : super(name, cause) { - this.name = name - } - - public constructor( - name: String, - message: String?, - cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.name = name - } - - - override fun createCopy(): IncorrectNameException? { - return IncorrectNameException( - name = this.name, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/NameConflictException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/NameConflictException.kt deleted file mode 100644 index d6cb1b2..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/NameConflictException.kt +++ /dev/null @@ -1,68 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class NameConflictException : SchemaDefinitionException, CopyableThrowable { - public val scope: Any - public val nameOwner: Any - public val name: String - - public constructor(scope: Any, nameOwner: Any, name: String) : super(formatMessage(scope, nameOwner, name)) { - this.scope = scope - this.nameOwner = nameOwner - this.name = name - } - - public constructor(scope: Any, nameOwner: Any, name: String, customMessage: String) : super(customMessage) { - this.scope = scope - this.nameOwner = nameOwner - this.name = name - } - - public constructor(scope: Any, nameOwner: Any, name: String, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.scope = scope - this.nameOwner = nameOwner - this.name = name - } - - - public constructor(scope: Any, nameOwner: Any, name: String, cause: Throwable) : super(formatMessage(scope, nameOwner, name), cause) { - this.scope = scope - this.nameOwner = nameOwner - this.name = name - } - - public constructor( - scope: Any, nameOwner: Any, name: String, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.scope = scope - this.nameOwner = nameOwner - this.name = name - } - - override fun createCopy(): NameConflictException? { - return NameConflictException( - scope = this.scope, - nameOwner = this.nameOwner, - name = this.name, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - scope: Any, nameOwner: Any, name: String, - ): String = "Name '${name}' already taken by $nameOwner inside $scope" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/NamespaceAlreadyBusyException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/NamespaceAlreadyBusyException.kt deleted file mode 100644 index c66391f..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/NamespaceAlreadyBusyException.kt +++ /dev/null @@ -1,54 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException -import ru.landgrafhomyak.db.skeleton1.api.module.Namespace - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class NamespaceAlreadyBusyException : SchemaDefinitionException, CopyableThrowable { - public val namespace: Namespace<*> - - public constructor(namespace: Namespace<*>) : super(formatMessage(namespace)) { - this.namespace = namespace - } - - public constructor(namespace: Namespace<*>, customMessage: String) : super(customMessage) { - this.namespace = namespace - } - - public constructor(namespace: Namespace<*>, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.namespace = namespace - } - - public constructor(namespace: Namespace<*>, cause: Throwable) : super(formatMessage(namespace), cause) { - this.namespace = namespace - } - - public constructor( - namespace: Namespace<*>, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.namespace = namespace - } - - override fun createCopy(): NamespaceAlreadyBusyException? { - return NamespaceAlreadyBusyException( - namespace = this.namespace, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - namespace: Namespace<*> - ): String = "Namespace ${namespace.name} is busy: attempt to allocate something in namespace captured by module or attempt to substitute module to non-empty namespace" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/TableWithoutColumnsException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/TableWithoutColumnsException.kt deleted file mode 100644 index 3f6c913..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/TableWithoutColumnsException.kt +++ /dev/null @@ -1,54 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException -import ru.landgrafhomyak.db.skeleton1.api.table.Table - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class TableWithoutColumnsException : SchemaDefinitionException, CopyableThrowable { - public val table: Table<*, *> - - public constructor(table: Table<*, *>) : super(formatMessage(table)) { - this.table = table - } - - public constructor(table: Table<*, *>, customMessage: String) : super(customMessage) { - this.table = table - } - - public constructor(table: Table<*, *>, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.table = table - } - - public constructor(table: Table<*, *>, cause: Throwable) : super(formatMessage(table), cause) { - this.table = table - } - - public constructor( - table: Table<*, *>, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.table = table - } - - override fun createCopy(): TableWithoutColumnsException? { - return TableWithoutColumnsException( - table = this.table, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - table: Table<*, *>, - ): String = "Table $table doesn't have columns" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnboundParameterException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnboundParameterException.kt deleted file mode 100644 index ef8cc93..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnboundParameterException.kt +++ /dev/null @@ -1,34 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -public abstract class UnboundParameterException : SchemaDefinitionException { - public val constructor: Any - - public constructor(constructor: Any) : super() { - this.constructor = constructor - } - - public constructor(constructor: Any, customMessage: String) : super(customMessage) { - this.constructor = constructor - } - - public constructor(constructor: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.constructor = constructor - } - - public constructor(constructor: Any, cause: Throwable) : super(cause) { - this.constructor = constructor - } - - public constructor( - constructor: Any, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.constructor = constructor - } - -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnknownVersionException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnknownVersionException.kt deleted file mode 100644 index bf87937..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnknownVersionException.kt +++ /dev/null @@ -1,61 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException -import ru.landgrafhomyak.db.skeleton1.api.module.Module - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class UnknownVersionException : SchemaDefinitionException, CopyableThrowable { - public val template: Module.Template<*> - public val version: String - - public constructor(template: Module.Template<*>, version: String) : super(formatMessage(template, version)) { - this.template = template - this.version = version - } - - public constructor(template: Module.Template<*>, version: String, customMessage: String) : super(customMessage) { - this.template = template - this.version = version - } - - public constructor(template: Module.Template<*>, version: String, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.template = template - this.version = version - } - - public constructor(template: Module.Template<*>, version: String, cause: Throwable) : super(formatMessage(template, version), cause) { - this.template = template - this.version = version - } - - public constructor( - template: Module.Template<*>, version: String, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.template = template - this.version = version - } - - override fun createCopy(): UnknownVersionException? { - return UnknownVersionException( - template = this.template, - version = this.version, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - template: Module.Template<*>, version: String - ): String = "Template $template doesn't knows version '${version}'" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnreferencedEntityAtUpgradeException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnreferencedEntityAtUpgradeException.kt deleted file mode 100644 index 48e0db4..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/UnreferencedEntityAtUpgradeException.kt +++ /dev/null @@ -1,62 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class UnreferencedEntityAtUpgradeException : SchemaDefinitionException, CopyableThrowable { - public val oldScope: Any - public val unprocessedEntities: Collection - - public constructor(oldScope: Any, unprocessedEntities: Collection) : super(formatMessage(oldScope, unprocessedEntities)) { - this.oldScope = oldScope - this.unprocessedEntities = unprocessedEntities - } - - public constructor(oldScope: Any, unprocessedEntities: Collection, customMessage: String) : super(customMessage) { - this.oldScope = oldScope - this.unprocessedEntities = unprocessedEntities - } - - public constructor(oldScope: Any, unprocessedEntities: Collection, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.oldScope = oldScope - this.unprocessedEntities = unprocessedEntities - } - - - public constructor(oldScope: Any, unprocessedEntities: Collection, cause: Throwable) : super(formatMessage(oldScope, unprocessedEntities), cause) { - this.oldScope = oldScope - this.unprocessedEntities = unprocessedEntities - } - - public constructor( - oldScope: Any, unprocessedEntities: Collection, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.oldScope = oldScope - this.unprocessedEntities = unprocessedEntities - } - - override fun createCopy(): UnreferencedEntityAtUpgradeException? { - return UnreferencedEntityAtUpgradeException( - oldScope = this.oldScope, - unprocessedEntities = this.unprocessedEntities, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - scope: Any, - entities: Collection, - ): String = "While upgrading $scope following entities wasn't referenced: ${entities.joinToString()}" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/VersionDuplicationException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/VersionDuplicationException.kt deleted file mode 100644 index 7b8dfa4..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/VersionDuplicationException.kt +++ /dev/null @@ -1,75 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException -import ru.landgrafhomyak.db.skeleton1.api.module.Module - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class VersionDuplicationException : SchemaDefinitionException, CopyableThrowable { - public val template: Module.Template<*> - public val versionOwner: Module<*> - public val newModule: Module<*> - public val version: String - - public constructor(template: Module.Template<*>, versionOwner: Module<*>, newModule: Module<*>, version: String) : super(formatMessage(template, versionOwner, newModule, version)) { - this.template = template - this.versionOwner = versionOwner - this.newModule = newModule - this.version = version - } - - public constructor(template: Module.Template<*>, versionOwner: Module<*>, newModule: Module<*>, version: String, customMessage: String) : super(customMessage) { - this.template = template - this.versionOwner = versionOwner - this.newModule = newModule - this.version = version - } - - public constructor(template: Module.Template<*>, versionOwner: Module<*>, newModule: Module<*>, version: String, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.template = template - this.versionOwner = versionOwner - this.newModule = newModule - this.version = version - } - - public constructor(template: Module.Template<*>, versionOwner: Module<*>, newModule: Module<*>, version: String, cause: Throwable) : super(formatMessage(template, versionOwner, newModule, version), cause) { - this.template = template - this.versionOwner = versionOwner - this.newModule = newModule - this.version = version - } - - public constructor( - template: Module.Template<*>, versionOwner: Module<*>, newModule: Module<*>, version: String, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.template = template - this.versionOwner = versionOwner - this.newModule = newModule - this.version = version - } - - override fun createCopy(): VersionDuplicationException? { - return VersionDuplicationException( - template = this.template, - versionOwner = this.versionOwner, - newModule = this.newModule, - version = this.version, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - template: Module.Template<*>, versionOwner: Module<*>, newModule: Module<*>, version: String - ): String = "Version '${version}' already associated with $versionOwner and $newModule provided by $template has the same version (circular upgrades are prohibited)" - } -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/WrongScopeException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/WrongScopeException.kt deleted file mode 100644 index 63f3a2f..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/definition/WrongScopeException.kt +++ /dev/null @@ -1,67 +0,0 @@ -package ru.landgrafhomyak.db.skeleton1.api.errors.definition - -import kotlin.jvm.JvmStatic -import kotlinx.coroutines.CopyableThrowable -import kotlinx.coroutines.ExperimentalCoroutinesApi -import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi -import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException - -@ReflectionApi -@OptIn(ExperimentalCoroutinesApi::class) -public class WrongScopeException : SchemaDefinitionException, CopyableThrowable { - public val wrongObject: Any - public val currentScope: Any - public val correctScope: Any - - public constructor(wrongObject: Any, currentScope: Any, correctScope: Any) : super(formatMessage(wrongObject, currentScope, correctScope)) { - this.wrongObject = wrongObject - this.currentScope = currentScope - this.correctScope = correctScope - } - - public constructor(wrongObject: Any, currentScope: Any, correctScope: Any, customMessage: String) : super(customMessage) { - this.wrongObject = wrongObject - this.currentScope = currentScope - this.correctScope = correctScope - } - - public constructor(wrongObject: Any, currentScope: Any, correctScope: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) { - this.wrongObject = wrongObject - this.currentScope = currentScope - this.correctScope = correctScope - } - - public constructor(wrongObject: Any, currentScope: Any, correctScope: Any, cause: Throwable) : super(formatMessage(wrongObject, currentScope, correctScope), cause) { - this.wrongObject = wrongObject - this.currentScope = currentScope - this.correctScope = correctScope - } - - public constructor( - wrongObject: Any, currentScope: Any, correctScope: Any, - message: String?, cause: Throwable?, - @Suppress("unused", "LocalVariableName") _marker: Unit - ) : super(message, cause, _marker) { - this.wrongObject = wrongObject - this.currentScope = currentScope - this.correctScope = correctScope - } - - override fun createCopy(): WrongScopeException? { - return WrongScopeException( - wrongObject = this.wrongObject, - currentScope = this.currentScope, - correctScope = this.correctScope, - message = this.message, - cause = this.cause, - _marker = Unit - ) - } - - public companion object { - @JvmStatic - public fun formatMessage( - wrongObject: Any, currentScope: Any, correctScope: Any - ): String = "Entity $wrongObject passed to wrong scope $currentScope (must be $correctScope)" - } -} \ No newline at end of file