More simplified errors (but still not final)

This commit is contained in:
Andrew Golovashevich 2025-05-29 00:45:59 +03:00
parent b398ce69e8
commit b0448030ae
9 changed files with 43 additions and 136 deletions

View File

@ -10,60 +10,11 @@ import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
@ReflectionApi @ReflectionApi
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
public class AccessWhileInitializationException : IllegalStateException, CopyableThrowable<AccessWhileInitializationException> { public class AccessWhileInitializationException : IllegalStateException, CopyableThrowable<AccessWhileInitializationException> {
public val scope: Any public constructor() : super()
public val `object`: Any public constructor(message: String?) : super(message)
public val member: Any public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable?) : super(cause)
public constructor(scope: Any, `object`: Any, member: Any) : super(formatMessage(scope, `object`, member)) { override fun createCopy(): AccessWhileInitializationException? =
this.scope = scope AccessWhileInitializationException(this.message, this.cause)
this.`object` = `object`
this.member = member
}
public constructor(scope: Any, `object`: Any, member: Any, customMessage: String) : super(customMessage) {
this.scope = scope
this.`object` = `object`
this.member = member
}
public constructor(scope: Any, `object`: Any, member: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) {
this.scope = scope
this.`object` = `object`
this.member = member
}
public constructor(scope: Any, `object`: Any, member: Any, cause: Throwable) : super(formatMessage(scope, `object`, member), cause) {
this.scope = scope
this.`object` = `object`
this.member = member
}
public constructor(
scope: Any, `object`: Any, member: Any,
message: String?,
cause: Throwable?,
@Suppress("unused", "LocalVariableName") _marker: Unit
) : super(message, cause) {
this.scope = scope
this.`object` = `object`
this.member = member
}
override fun createCopy(): AccessWhileInitializationException? {
return AccessWhileInitializationException(
scope = this.scope,
`object` = this.`object`,
member = this.member,
message = this.message,
cause = this.cause,
_marker = Unit
)
}
public companion object {
@JvmStatic
public fun formatMessage(scope: Any, `object`: Any, member: Any): String =
"Attempt to access $member of $`object` before it's producer scope $scope not finished"
}
} }

View File

@ -1,55 +0,0 @@
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.ReflectionApi
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
@ReflectionApi
@OptIn(ExperimentalCoroutinesApi::class)
public class EntityDeletedException : IllegalStateException, CopyableThrowable<EntityDeletedException> {
public val entity: Any
public constructor(entity: Any) : super(formatMessage(entity)) {
this.entity = entity
}
public constructor(entity: Any, customMessage: String) : super(customMessage) {
this.entity = entity
}
public constructor(entity: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) {
this.entity = entity
}
public constructor(entity: Any, cause: Throwable) : super(formatMessage(entity), cause) {
this.entity = entity
}
public constructor(
entity: Any,
message: String?,
cause: Throwable?,
@Suppress("unused", "LocalVariableName") _marker: Unit
) : super(message, cause) {
this.entity = entity
}
override fun createCopy(): EntityDeletedException? {
return EntityDeletedException(
entity = this.entity,
message = this.message,
cause = this.cause,
_marker = Unit
)
}
public companion object {
@JvmStatic
public fun formatMessage(entity: Any): String =
"Attempt to access deleted $entity"
}
}

View File

@ -0,0 +1,17 @@
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.ReflectionApi
@ReflectionApi
@OptIn(ExperimentalCoroutinesApi::class)
public class EntityOutdatedException : IllegalArgumentException, CopyableThrowable<EntityOutdatedException> {
public constructor() : super()
public constructor(message: String?) : super(message)
public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable?) : super(cause)
override fun createCopy(): EntityOutdatedException? = EntityOutdatedException(this.message, this.cause)
}

View File

@ -6,8 +6,7 @@ import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
@ReflectionApi @ReflectionApi
public abstract class ExecutionException : RuntimeException { public abstract class ExecutionException : RuntimeException {
public constructor() : super() public constructor() : super()
public constructor(message: String) : super(message) public constructor(message: String?) : super(message)
public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable) : super(cause) public constructor(cause: Throwable?) : super(cause)
public constructor(message: String?, cause: Throwable?, @Suppress("unused", "LocalVariableName") _marker: Unit) : super(message, cause)
} }

View File

@ -8,16 +8,15 @@ import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
@ReflectionApi @ReflectionApi
public open class InternalDriverException : RuntimeException, CopyableThrowable<InternalDriverException> { public open class InternalDriverException : RuntimeException, CopyableThrowable<InternalDriverException> {
public constructor() : super() public constructor() : super()
public constructor(message: String) : super(message) public constructor(message: String?) : super(message)
public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable) : super(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? { override fun createCopy(): InternalDriverException? {
if (this::class !== InternalDriverException::class) if (this::class !== InternalDriverException::class)
return null return null
return InternalDriverException(this.message, this.cause, Unit) return InternalDriverException(this.message, this.cause)
} }
} }

View File

@ -8,15 +8,14 @@ import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
@ReflectionApi @ReflectionApi
public open class SchemaDefinitionException : RuntimeException, CopyableThrowable<SchemaDefinitionException> { public open class SchemaDefinitionException : RuntimeException, CopyableThrowable<SchemaDefinitionException> {
public constructor() : super() public constructor() : super()
public constructor(message: String) : super(message) public constructor(message: String?) : super(message)
public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable) : super(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? { override fun createCopy(): SchemaDefinitionException? {
if (this::class !== SchemaDefinitionException::class) if (this::class !== SchemaDefinitionException::class)
return null return null
return SchemaDefinitionException(this.message, this.cause, Unit) return SchemaDefinitionException(this.message, this.cause)
} }
} }

View File

@ -5,8 +5,7 @@ import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
@ReflectionApi @ReflectionApi
public abstract class SchemaSynchronizationException : RuntimeException { public abstract class SchemaSynchronizationException : RuntimeException {
public constructor() : super() public constructor() : super()
public constructor(message: String) : super(message) public constructor(message: String?) : super(message)
public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable) : super(cause) public constructor(cause: Throwable?) : super(cause)
public constructor(message: String?, cause: Throwable?, @Suppress("unused", "LocalVariableName") _marker: Unit) : super(message, cause)
} }

View File

@ -6,8 +6,7 @@ import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaSynchronizationException
@ReflectionApi @ReflectionApi
public abstract class SchemaExecutionException : SchemaSynchronizationException { public abstract class SchemaExecutionException : SchemaSynchronizationException {
public constructor() : super() public constructor() : super()
public constructor(message: String) : super(message) public constructor(message: String?) : super(message)
public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable) : super(cause) public constructor(cause: Throwable?) : super(cause)
public constructor(message: String?, cause: Throwable?, @Suppress("unused", "LocalVariableName") _marker: Unit) : super(message, cause, _marker)
} }

View File

@ -6,8 +6,7 @@ import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaSynchronizationException
@ReflectionApi @ReflectionApi
public abstract class SchemaMismatchException : SchemaSynchronizationException { public abstract class SchemaMismatchException : SchemaSynchronizationException {
public constructor() : super() public constructor() : super()
public constructor(message: String) : super(message) public constructor(message: String?) : super(message)
public constructor(message: String, cause: Throwable) : super(message, cause) public constructor(message: String?, cause: Throwable?) : super(message, cause)
public constructor(cause: Throwable) : super(cause) public constructor(cause: Throwable?) : super(cause)
public constructor(message: String?, cause: Throwable?, @Suppress("unused", "LocalVariableName") _marker: Unit) : super(message, cause, _marker)
} }