Skip to content

Commit c106b4d

Browse files
committed
Make errors used in cluster sync API unwrappable
Implement Unwrap() functions on sync package errors. This allows e.g. retreiving the underlying error behind a sync.UnrecoverableSyncError Signed-off-by: Angel Misevski <[email protected]>
1 parent 6ee1358 commit c106b4d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/provision/sync/cluster_api.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ func (e *UnrecoverableSyncError) Error() string {
6868
return e.Cause.Error()
6969
}
7070

71+
func (e *UnrecoverableSyncError) Unwrap() error {
72+
return e.Cause
73+
}
74+
7175
// WarningError is returned when syncing is successful and can continue but there is a warning
7276
// regarding the objects synced to the cluster (e.g. they will not be updated)
7377
type WarningError struct {
@@ -81,3 +85,7 @@ func (e *WarningError) Error() string {
8185
}
8286
return e.Message
8387
}
88+
89+
func (e *WarningError) Unwrap() error {
90+
return e.Err
91+
}

0 commit comments

Comments
 (0)