DefaultErrorInfo

data class DefaultErrorInfo(val errorCode: String, val errorMsg: String = "", val bindingErrors: List<BindingError> = emptyList()) : ErrorInfo, Materialized

Default implementation of the ErrorInfo interface.

This data class provides a concrete, serializable implementation of error information that can be used directly in API responses, logging, and error handling. It implements Materialized to ensure it can be properly serialized in JSON responses and stored in databases.

See also

for the interface definition

for convenient factory method

// Create a simple error
val error = DefaultErrorInfo("NOT_FOUND", "User not found")

// Create an error with binding details
val validationError = DefaultErrorInfo(
errorCode = "VALIDATION_ERROR",
errorMsg = "Input validation failed",
bindingErrors = listOf(
BindingError("email", "Invalid format"),
BindingError("password", "Too short")
)
)

Constructors

Link copied to clipboard
constructor(errorCode: String, errorMsg: String = "", bindingErrors: List<BindingError> = emptyList())

Properties

Link copied to clipboard
open override val bindingErrors: List<BindingError>

A list of field-level validation errors (empty by default)

Link copied to clipboard
open override val errorCode: String

The error code that identifies the type of error

Link copied to clipboard
open override val errorMsg: String

A human-readable message describing the error (empty for success)