toErrorInfo

Converts this Throwable to standardized ErrorInfo.

This extension function looks up the appropriate error converter for this exception's type and uses it to convert the exception to ErrorInfo. If no specific converter is registered, it falls back to the DefaultErrorConverter.

Example usage:

try {
// some operation
} catch (e: Exception) {
val errorInfo = e.toErrorInfo()
// handle standardized error
}

Receiver

the exception to convert

Return

the standardized error information

See also