mirror of
https://github.com/corda/corda.git
synced 2025-06-13 20:58:19 +00:00
Custom exceptions in corda, should either derive from an appropriate closely related java exception, or CordaException, or CordaRuntimeException. They should not inherit just from Exception, or RuntimeException.
Handle PR comments Add nicer constructors to CordaException and CordaRuntimeException (cherry picked from commit89478c8
) Fix ambiguous defaulted constructor (cherry picked from commitec9bafe
) Address PR comment Update a few more custom exceptions
This commit is contained in:
@ -67,7 +67,7 @@ class ThrowableSerializer(factory: SerializerFactory) : CustomSerializer.Proxy<T
|
||||
logger.warn("Unexpected exception de-serializing throwable: ${proxy.exceptionClass}. Converting to CordaRuntimeException.", e)
|
||||
}
|
||||
// If the criteria are not met or we experience an exception constructing the exception, we fall back to our own unchecked exception.
|
||||
return CordaRuntimeException(proxy.exceptionClass).apply {
|
||||
return CordaRuntimeException(proxy.exceptionClass, null, null).apply {
|
||||
this.setMessage(proxy.message)
|
||||
this.setCause(proxy.cause)
|
||||
this.stackTrace = proxy.stackTrace
|
||||
|
@ -1,11 +1,14 @@
|
||||
package net.corda.nodeapi.internal.serialization.carpenter
|
||||
|
||||
class DuplicateNameException : RuntimeException(
|
||||
import net.corda.core.CordaException
|
||||
import net.corda.core.CordaRuntimeException
|
||||
|
||||
class DuplicateNameException : CordaRuntimeException(
|
||||
"An attempt was made to register two classes with the same name within the same ClassCarpenter namespace.")
|
||||
|
||||
class InterfaceMismatchException(msg: String) : RuntimeException(msg)
|
||||
class InterfaceMismatchException(msg: String) : CordaRuntimeException(msg)
|
||||
|
||||
class NullablePrimitiveException(msg: String) : RuntimeException(msg)
|
||||
class NullablePrimitiveException(msg: String) : CordaRuntimeException(msg)
|
||||
|
||||
class UncarpentableException(name: String, field: String, type: String) :
|
||||
Exception("Class $name is loadable yet contains field $field of unknown type $type")
|
||||
CordaException("Class $name is loadable yet contains field $field of unknown type $type")
|
||||
|
Reference in New Issue
Block a user