trait BaseCantonError extends BaseError
The main Canton error for everything that should be logged and notified
In many cases, we return errors that are communicated to clients as a Left. For such cases, we should use CantonError to report them.
For an actual error instance, you should extend one of the given abstract error classes such as CantonError.Impl further below (or transaction error).
There are two ways to communicate such an error: write it into a log or send it as a string to the user. In most cases, we'll do both: log the error appropriately locally and communicate it to the user by failing the api call with an error string.
When we log the error, then we write: 1) ErrorCode 2) ErrorName (name of the class defining the error code) 3) The cause 4) The context
The context is given by the following: 1) All arguments of the error case class turned into strings (which invokes pretty printing of the arguments) EXCEPT: we ignore arguments that have the following RESERVED name: cause, loggingContext, throwable. 2) The context of the logger (e.g. participant=participant1, domain=da) 3) The trace id.
- Alphabetic
- By Inheritance
- BaseCantonError
- BaseError
- LocationMixin
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def cause: String
A human readable string indicating the error
A human readable string indicating the error
- Definition Classes
- BaseError
- abstract def code: ErrorCode
The error code, usually passed in as implicit where the error class is defined
The error code, usually passed in as implicit where the error class is defined
- Definition Classes
- BaseCantonError → BaseError
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def asGoogleGrpcStatus(implicit loggingContext: ErrorLoggingContext): Status
- def asGrpcError(implicit loggingContext: ErrorLoggingContext): StatusRuntimeException
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def context: Map[String, String]
The context (declared fields) of this error
The context (declared fields) of this error
- Definition Classes
- BaseCantonError → BaseError
- def definiteAnswerO: Option[Boolean]
Controls whether a
definite_answer
error detail is added to the gRPC status codeControls whether a
definite_answer
error detail is added to the gRPC status code- Definition Classes
- BaseError
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val location: Option[String]
Contains the location where the error has been created.
Contains the location where the error has been created.
- Definition Classes
- LocationMixin
- def log()(implicit loggingContext: ErrorLoggingContext): Unit
- def logWithContext(extra: Map[String, String] = Map())(implicit contextualizedErrorLogger: ContextualizedErrorLogger): Unit
- Definition Classes
- BaseError
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def resources: Seq[(ErrorResource, String)]
The resources related to this error
The resources related to this error
We return the set of resources via com.google.rpc.ResourceInfo. Override this method in order to return resource information via com.google.rpc.Status
- Definition Classes
- BaseError
- def retryable: Option[ErrorCategoryRetry]
Returns retryability information of this particular error
Returns retryability information of this particular error
In some cases, error instances would like to provide custom retry intervals. This can be achieved by locally overriding this method.
Do not use this to change the contract of the error categories. Non-retryable errors shouldn't be made retryable. Only use it for adjusting the retry intervals.
- Definition Classes
- BaseError
- def rpcStatus(overrideCode: Option[Code] = None)(implicit loggingContext: ErrorLoggingContext): Status
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def throwableO: Option[Throwable]
An optional argument to log exceptions
An optional argument to log exceptions
If you want to log an exception as part of your error, then use the following example:
object MyCode extends ErrorCode(id="SUPER_DUPER_ERROR") { case class MyError(someString: String, throwable: Throwable) extends SomeInternalError( cause = "Something failed with an exception bla", throwableO = Some(throwable) ) }
NOTE: This throwable's details are not included the exception communicated to the gRPC clients so if you want them communicated, you need to explicitly add them to the e.g. context map or cause string.
- Definition Classes
- BaseError
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])