Skip to content

Commit

Permalink
Merge pull request #135 from sonroyaalmerol/update-error
Browse files Browse the repository at this point in the history
add error logs for database update errors
  • Loading branch information
sonroyaalmerol authored Feb 7, 2025
2 parents 3fd299f + a658c79 commit 0577f7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cmd/pbs_plus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ func main() {
jobTask.LastRunPlusError = err.Error()
jobTask.LastRunPlusTime = int(time.Now().Unix())

_ = storeInstance.Database.UpdateJob(*jobTask)
uErr := storeInstance.Database.UpdateJob(*jobTask)
if uErr != nil {
syslog.L.Errorf("LastRunPlusError update: %v", uErr)
}
}
syslog.L.Error(err)
return
Expand Down
6 changes: 5 additions & 1 deletion internal/proxy/controllers/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/sonroyaalmerol/pbs-plus/internal/proxy/controllers"
"github.com/sonroyaalmerol/pbs-plus/internal/store"
"github.com/sonroyaalmerol/pbs-plus/internal/store/types"
"github.com/sonroyaalmerol/pbs-plus/internal/syslog"
"github.com/sonroyaalmerol/pbs-plus/internal/utils"
)

Expand Down Expand Up @@ -64,7 +65,10 @@ func ExtJsJobRunHandler(storeInstance *store.Store) http.HandlerFunc {
job.LastRunPlusError = err.Error()
job.LastRunPlusTime = int(time.Now().Unix())

_ = storeInstance.Database.UpdateJob(*job)
uErr := storeInstance.Database.UpdateJob(*job)
if uErr != nil {
syslog.L.Errorf("LastRunPlusError update: %v", uErr)
}
}

controllers.WriteErrorResponse(w, err)
Expand Down

0 comments on commit 0577f7c

Please sign in to comment.