Some missed errors

This commit is contained in:
Andrew Golovashevich 2025-05-16 15:57:55 +03:00
parent d35db7e721
commit 3633ed898d
4 changed files with 182 additions and 26 deletions

View File

@ -0,0 +1,56 @@
package ru.landgrafhomyak.db.skeleton1.api.errors
import kotlin.jvm.JvmStatic
import kotlinx.coroutines.CopyableThrowable
import kotlinx.coroutines.ExperimentalCoroutinesApi
import ru.landgrafhomyak.db.skeleton1.api.DebugApi
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
@DebugApi
@OptIn(ExperimentalCoroutinesApi::class)
public class AccessWhileInitializationException : IllegalStateException, CopyableThrowable<AccessWhileInitializationException> {
public val `object`: Any
public val member: Any
public constructor(`object`: Any, member: Any) : super() {
this.`object` = `object`
this.member = member
}
public constructor(`object`: Any, member: Any, message: String) : super(message) {
this.`object` = `object`
this.member = member
}
public constructor(`object`: Any, member: Any, message: String, cause: Throwable) : super(message, cause) {
this.`object` = `object`
this.member = member
}
public constructor(`object`: Any, member: Any, cause: Throwable) : super(cause) {
this.`object` = `object`
this.member = member
}
public constructor(
`object`: Any, member: Any,
message: String?,
cause: Throwable?,
@Suppress("unused", "LocalVariableName") _marker: Unit
) : super(message, cause) {
this.`object` = `object`
this.member = member
}
override fun createCopy(): AccessWhileInitializationException? {
return AccessWhileInitializationException(
`object` = this.`object`,
member = this.member,
message = this.message,
cause = this.cause,
_marker = Unit
)
}
}

View File

@ -0,0 +1,60 @@
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.DebugApi
import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException
@DebugApi
@OptIn(ExperimentalCoroutinesApi::class)
public class ExportedEntitiesNotImportedException : SchemaDefinitionException, CopyableThrowable<ExportedEntitiesNotImportedException> {
public val sourceScope: Any
public val entities: Collection<Any>
public constructor(sourceScope: Any, entities: Collection<Any>) : super(formatMessage(sourceScope, entities)) {
this.sourceScope = sourceScope
this.entities = entities
}
public constructor(sourceScope: Any, entities: Collection<Any>, customMessage: String) : super(customMessage) {
this.sourceScope = sourceScope
this.entities = entities
}
public constructor(sourceScope: Any, entities: Collection<Any>, customMessage: String, cause: Throwable) : super(customMessage, cause) {
this.sourceScope = sourceScope
this.entities = entities
}
public constructor(sourceScope: Any, entities: Collection<Any>, cause: Throwable) : super(formatMessage(sourceScope, entities), cause) {
this.sourceScope = sourceScope
this.entities = entities
}
public constructor(
sourceScope: Any, entities: Collection<Any>,
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<Any>,
): String = "Entities exported from $sourceScope wasn't imported to any other scope: ${entities.joinToString()}"
}
}

View File

@ -11,54 +11,40 @@ import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
@DebugApi
@OptIn(ExperimentalCoroutinesApi::class)
public class IncorrectNameException : SchemaDefinitionException, CopyableThrowable<IncorrectNameException> {
public val statement: _Statement<*, *>
public val params: Collection<InputParam<*, *, *>>
public val name: String
public constructor(statement: _Statement<*, *>, params: Collection<InputParam<*, *, *>>) : super(formatMessage(statement, params)) {
this.statement = statement
this.params = params
public constructor(name: String) : super(name) {
this.name = name
}
public constructor(statement: _Statement<*, *>, params: Collection<InputParam<*, *, *>>, message: String) : super(message) {
this.statement = statement
this.params = params
public constructor(name: String, customMessage: String) : super(customMessage) {
this.name = name
}
public constructor(statement: _Statement<*, *>, params: Collection<InputParam<*, *, *>>, message: String, cause: Throwable) : super(message, cause) {
this.statement = statement
this.params = params
public constructor(name: String, customMessage: String, cause: Throwable) : super(customMessage, cause) {
this.name = name
}
public constructor(statement: _Statement<*, *>, params: Collection<InputParam<*, *, *>>, cause: Throwable) : super(formatMessage(statement, params), cause) {
this.statement = statement
this.params = params
public constructor(name: String, cause: Throwable) : super(name, cause) {
this.name = name
}
public constructor(
statement: _Statement<*, *>,
params: Collection<InputParam<*, *, *>>,
name: String,
message: String?,
cause: Throwable?,
@Suppress("unused", "LocalVariableName") _marker: Unit
) : super(message, cause, _marker) {
this.statement = statement
this.params = params
this.name = name
}
override fun createCopy(): IncorrectNameException? {
return IncorrectNameException(
statement = this.statement,
params = this.params,
name = this.name,
message = this.message,
cause = this.cause,
_marker = Unit
)
}
public companion object {
@JvmStatic
public fun formatMessage(statement: _Statement<*, *>, params: Collection<InputParam<*, *, *>>): String =
"While preparing statement $statement following parameters wasn't initialized: ${params.joinToString()}"
}
}

View File

@ -0,0 +1,54 @@
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.DebugApi
import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaDefinitionException
import ru.landgrafhomyak.db.skeleton1.api.table.Table
@DebugApi
@OptIn(ExperimentalCoroutinesApi::class)
public class TableWithoutColumnsException : SchemaDefinitionException, CopyableThrowable<TableWithoutColumnsException> {
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"
}
}