[EG-438] Error Reporting Framework (#6125)

* [EG-438] First commit of error code interface

* [EG-438] Implement error reporter and a few error codes

* [EG-438] Add unit tests and default properties files

* [EG-438] Add the error table builder

* [EG-438] Update initial properties files

* [EG-438] Add some Irish tests and the build.gradle

* [EG-438] Fall back for aliases and use different resource strategy

* [EG-438] Define the URL using a project-specific context

* [EG-438] Tidy up initialization code

* [EG-438] Add testing to generator and tidy up

* [EG-438] Remove direct dependency on core and add own logging config

* [EG-438] Fix compiler warnings and tidy up logging

* [EG-438] Fix detekt warnings

* [EG-438] Improve error messages

* [EG-438] Address first set of review comments

* [EG-438] Use enums and a builder for the reporter

* [EG-438] Add kdocs for error resource static methods

* [EG-438] Handle enums defined with underscores

* [EG-438] Slight refactoring of startup code

* [EG-438] Port changes to error reporting code from future branch

* [EG-438] Also port test changes

* [EG-438] Suppress a deliberately unused parameter
This commit is contained in:
James Higgs
2020-04-28 14:07:50 +01:00
committed by GitHub
parent 3b335ebb00
commit ab43238420
52 changed files with 869 additions and 5 deletions

View File

@ -4,10 +4,13 @@ import co.paralleluniverse.strands.Strand
import com.zaxxer.hikari.HikariDataSource
import com.zaxxer.hikari.pool.HikariPool
import com.zaxxer.hikari.util.ConcurrentBag
import net.corda.common.logging.errorReporting.ErrorCode
import net.corda.core.flows.HospitalizeFlowException
import net.corda.core.internal.NamedCacheFactory
import net.corda.core.schemas.MappedSchema
import net.corda.core.utilities.contextLogger
import net.corda.common.logging.errorReporting.NodeDatabaseErrors
import net.corda.common.logging.errorReporting.NodeNamespaces
import org.hibernate.tool.schema.spi.SchemaManagementException
import rx.Observable
import rx.Subscriber
@ -405,7 +408,10 @@ private fun Throwable.hasSQLExceptionCause(): Boolean =
else -> cause?.hasSQLExceptionCause() ?: false
}
class CouldNotCreateDataSourceException(override val message: String?, override val cause: Throwable? = null) : Exception()
class CouldNotCreateDataSourceException(override val message: String?,
override val code: NodeDatabaseErrors,
override val parameters: List<Any> = listOf(),
override val cause: Throwable? = null) : ErrorCode<NodeDatabaseErrors>, Exception()
class HibernateSchemaChangeException(override val message: String?, override val cause: Throwable? = null): Exception()