summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-09-30 10:18:13 +0300
committerPaul Buetow <paul@buetow.org>2024-09-30 10:18:13 +0300
commit4d904e44a18acec779ef1d09de5d30e4890d1918 (patch)
tree32deb6ce1c88c550e29b70d848248ccd7e6e151d
parentc76ba11dc4ae23ab17115b87d0d2b9711ffdbf01 (diff)
fix error handling
-rw-r--r--internal/run.go8
-rw-r--r--internal/schedule/schedule.go1
2 files changed, 4 insertions, 5 deletions
diff --git a/internal/run.go b/internal/run.go
index ea70bec..a3d42df 100644
--- a/internal/run.go
+++ b/internal/run.go
@@ -17,13 +17,13 @@ func Run(ctx context.Context, args config.Args) error {
for _, platform := range args.Platforms {
path, err := schedule.Run(args, platform)
- switch err {
- case nil:
+ switch {
+ case err == nil:
log.Println("Scheduling", path)
// TODO: Implement action here to post it
- case schedule.ErrNothingToSchedule:
+ case errors.Is(err, schedule.ErrNothingToSchedule):
log.Println("Nothing to be scheduled for", platform)
- case schedule.ErrNothingQueued
+ case errors.Is(err, schedule.ErrNothingQueued):
log.Println("Nothing queued for", platform)
default:
return err
diff --git a/internal/schedule/schedule.go b/internal/schedule/schedule.go
index 82afc18..3d3061f 100644
--- a/internal/schedule/schedule.go
+++ b/internal/schedule/schedule.go
@@ -35,7 +35,6 @@ func Run(args config.Args, platform string) (string, error) {
})
if err != nil {
- // TODO: FIX THIS
return randomEntry, fmt.Errorf("%w: %w", ErrNothingQueued, err)
}
return randomEntry, nil