refactor(errorHandling): rename errorHandling -> handleError

This commit is contained in:
Yukine 2021-02-04 03:00:13 +01:00
parent a55cdc98fd
commit 9f004aede0
No known key found for this signature in database
GPG Key ID: 6AE0B5764F0126D1

View File

@ -88,7 +88,7 @@ func main() {
for _, volumeID := range volumeIDs { for _, volumeID := range volumeIDs {
volume, _, err := ctx.DoContext.GetVolume(volumeID) volume, _, err := ctx.DoContext.GetVolume(volumeID)
if err != nil { if err != nil {
errorHandling(ctx, err, true) handleError(ctx, err, true)
return return
} }
@ -97,7 +97,7 @@ func main() {
Name: fmt.Sprintf("%s-%s", volume.Name, time.Now().Format("2006-01-02 15:04:05")), Name: fmt.Sprintf("%s-%s", volume.Name, time.Now().Format("2006-01-02 15:04:05")),
}) })
if err != nil { if err != nil {
errorHandling(ctx, err, true) handleError(ctx, err, true)
return return
} }
@ -109,12 +109,12 @@ func main() {
sort.SliceStable(snapshots, func(firstIndex, secondIndex int) bool { sort.SliceStable(snapshots, func(firstIndex, secondIndex int) bool {
firstTime, err := time.Parse(snapshots[firstIndex].Created, createdAtFormat) firstTime, err := time.Parse(snapshots[firstIndex].Created, createdAtFormat)
if err != nil { if err != nil {
errorHandling(ctx, err, true) handleError(ctx, err, true)
} }
secondTime, err := time.Parse(snapshots[firstIndex].Created, createdAtFormat) secondTime, err := time.Parse(snapshots[firstIndex].Created, createdAtFormat)
if err != nil { if err != nil {
errorHandling(ctx, err, true) handleError(ctx, err, true)
} }
return firstTime.Before(secondTime) return firstTime.Before(secondTime)
@ -126,7 +126,7 @@ func main() {
_, err := ctx.DoContext.DeleteSnapshot(snapshots[i].ID) _, err := ctx.DoContext.DeleteSnapshot(snapshots[i].ID)
if err != nil { if err != nil {
errorHandling(ctx, err, false) handleError(ctx, err, false)
return 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() errString := err.Error()
if ctx.SlackContext != nil { if ctx.SlackContext != nil {