The Error interface represents an error. It is designed to provide a standard way to handle errors across different parts of the application.
interface ErrorThe Error interface is a marker interface used to encapsulate error information. Implementations of this interface should provide specific details about various types of errors.
To use this interface, create custom error types by implementing the Error interface. Each custom error type can provide additional fields and methods that describe the specific error condition.
Here is a simple example of how to create a custom error type:
/**
* Represents a custom error.
*/
data class CustomError(
val message: String,
val code: Int,
) : Error