From 9f004aede02cb301f9b6cb0001b70fc73d223e0e Mon Sep 17 00:00:00 2001 From: Yukine Date: Thu, 4 Feb 2021 03:00:13 +0100 Subject: [PATCH] refactor(errorHandling): rename errorHandling -> handleError --- cmd/DigitalOceanSnapshotter/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/DigitalOceanSnapshotter/main.go b/cmd/DigitalOceanSnapshotter/main.go index 556b2d1..457aeff 100644 --- a/cmd/DigitalOceanSnapshotter/main.go +++ b/cmd/DigitalOceanSnapshotter/main.go @@ -88,7 +88,7 @@ func main() { for _, volumeID := range volumeIDs { volume, _, err := ctx.DoContext.GetVolume(volumeID) if err != nil { - errorHandling(ctx, err, true) + handleError(ctx, err, true) return } @@ -97,7 +97,7 @@ func main() { Name: fmt.Sprintf("%s-%s", volume.Name, time.Now().Format("2006-01-02 15:04:05")), }) if err != nil { - errorHandling(ctx, err, true) + handleError(ctx, err, true) return } @@ -109,12 +109,12 @@ func main() { sort.SliceStable(snapshots, func(firstIndex, secondIndex int) bool { firstTime, err := time.Parse(snapshots[firstIndex].Created, createdAtFormat) if err != nil { - errorHandling(ctx, err, true) + handleError(ctx, err, true) } secondTime, err := time.Parse(snapshots[firstIndex].Created, createdAtFormat) if err != nil { - errorHandling(ctx, err, true) + handleError(ctx, err, true) } return firstTime.Before(secondTime) @@ -126,7 +126,7 @@ func main() { _, err := ctx.DoContext.DeleteSnapshot(snapshots[i].ID) if err != nil { - errorHandling(ctx, err, false) + handleError(ctx, err, false) return } } @@ -134,7 +134,7 @@ func main() { } } -func errorHandling(ctx snapshotterContext, err error, fatal bool) { +func handleError(ctx snapshotterContext, err error, fatal bool) { errString := err.Error() if ctx.SlackContext != nil {