Fix `fialed to watch` context canceled error when streaming logs
When streaming pipelineRun or taskRun logs, closing the stop channel to terminate the informer was causing "Failed to watch" error messages to be logged with "context canceled". This was noisy and confusing for users even though it was expected behavior during intentional shutdown.
This patch add custom watchErrorHandler function that filter out context.Canceled errors while passing other errors to the default handler. This prevents the error log messages when the CLI intentionally stops watching after a run completes.
Changes
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you review them:
- [ ] Includes tests (if functionality changed/added)
- [ ] Run the code checkers with
make check - [ ] Regenerate the manpages, docs and go formatting with
make generated - [ ] Commit messages follow commit message best practices
See the contribution guide for more details.
Release Notes
Fix `fialed to watch` context canceled error when streaming logs
/retest
cc: @divyansh42
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: divyansh42 To complete the pull request process, please ask for approval from pratap0007 after the PR has been reviewed.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment