# Functions
GetLocalizedMessage returns the localized error message
Parameters: - code: the error code - lang: the language code
Returns: - string: the localized error message.
InitLogFile initializes the log file
Parameters: - logFilePath: the path to the log file
Returns: - error: an error if the log file could not be initialized, otherwise nil.
LogError logs the error to both file and console
Parameters: - err: the error to log.
NewAggregateError creates a new AggregateError
Parameters: - errors: the list of errors to aggregate
Returns: - *AggregateError: the new AggregateError.
NewError creates a new custom error
Parameters: - code: the error code - message: the error message - level: the error level - context: the context information - original: the original error
Returns: - *CustomError: the new custom error.
NotifyError sends an error notification (example: send email)
Parameters: - err: the error to notify about - recipientEmail: the recipient email address.
RegisterErrorHandler registers a custom error handler
Parameters: - handler: the custom error handler to register.
TriggerCustomErrorHandlers triggers all registered custom error handlers
Parameters: - err: the error to handle.
Unwrap unwraps an error to get the original error
Parameters: - err: the wrapped error
Returns: - error: the original error.
Wrap wraps an error with an additional message
Parameters: - err: the original error - message: the additional message
Returns: - error: the wrapped error.
# Variables
Define common error types.
Define common error types.
Define common error types.
Define common error types.
# Structs
AggregateError aggregates multiple errors into one.
CustomError represents a custom error type.
# Interfaces
ErrorHandler is an interface for custom error handlers.
# Type aliases
ErrorLevel represents the severity level of an error.