29 lines
599 B
Go
29 lines
599 B
Go
package core
|
|
|
|
// BackupError represents an error that occurred during backup operations
|
|
type BackupError struct {
|
|
Message string
|
|
Cause error
|
|
}
|
|
|
|
// Error implements the error interface
|
|
func (e *BackupError) Error() string {
|
|
if e.Cause != nil {
|
|
return e.Message + ": " + e.Cause.Error()
|
|
}
|
|
return e.Message
|
|
}
|
|
|
|
// Unwrap returns the underlying cause of the error
|
|
func (e *BackupError) Unwrap() error {
|
|
return e.Cause
|
|
}
|
|
|
|
// NewBackupError creates a new BackupError
|
|
func NewBackupError(message string, cause error) *BackupError {
|
|
return &BackupError{
|
|
Message: message,
|
|
Cause: cause,
|
|
}
|
|
}
|