GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Replace empty catch blocks with proper error logging by Kamkmgamer · Pull Request #8271 · anomalyco/opencode

Conversation

@Kamkmgamer

@Kamkmgamer Kamkmgamer commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes 7 instances of empty catch blocks across 5 files that were silently swallowing errors, making debugging difficult and potentially masking critical failures.

Changes Made

1. packages/opencode/src/session/message-v2.ts

  • Added Log import for error logging
  • Replaced empty catch block in error response parsing with debug logging
  • Impact: Improves debugging of API error responses

2. packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

  • Added Log import for error logging
  • Replaced empty catch block in image paste handling with debug logging
  • Impact: Improves debugging of clipboard/paste operations

3. packages/opencode/src/session/retry.ts

  • Added Log import for error logging
  • Replaced empty catch block in error response parsing with debug logging
  • Impact: Improves debugging of retry mechanism

4. packages/opencode/src/pty/index.ts

  • Replaced two empty catch blocks with debug logging for process termination
  • Uses existing logger instance (Log.create({ service: "pty" }))
  • Impact: Improves debugging of PTY session management

5. packages/opencode/src/server/mdns.ts

  • Replaced empty catch block with debug logging for bonjour instance cleanup
  • Uses existing logger instance (Log.create({ service: "mdns" }))
  • Impact: Improves debugging of mDNS service discovery

Technical Details

  • ✅ Uses existing Log utility throughout codebase
  • ✅ Uses Log.Default.debug() and existing logger instances appropriately
  • ✅ Adds descriptive error messages with error context
  • ✅ Maintains existing control flow and error handling behavior
  • ✅ Only adds observability, no functional changes
  • ✅ Follows project's error handling preferences (prefer logging over silent failures)

Testing

  • All changes maintain existing behavior
  • No functionality changes, only observability improvements
  • Compatible with existing test suite

Impact

  • Improved Debugging: All error scenarios now logged at debug level
  • Zero Breaking Changes: Maintains existing behavior while adding observability
  • Production Ready: Uses existing logging infrastructure
  • Maintainable: Clear, descriptive log messages for future debugging

Files Changed

  • 5 files modified
  • 7 empty catch blocks replaced with proper error logging
  • 3 new Log imports added (2 files already had Log imported)

Verification

  • ✅ All changes follow existing code patterns
  • ✅ Uses established logging infrastructure
  • ✅ No changes to business logic or error handling behavior
  • ✅ Improves codebase maintainability and debuggability

Related Issues

Addresses technical debt identified in codebase review where empty catch blocks were silently swallowing errors, making production debugging nearly impossible.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Kamkmgamer added 5 commits January 13, 2026 20:39
@Kamkmgamer
fix(session): add error logging for failed error response parsing
4c19491
@Kamkmgamer
fix(prompt): add error logging for failed image paste
b4c7472
Previously, image paste failures were silently ignored. Now we log
the error with a debug message when pasting an image fails, falling
back to text insertion.
@Kamkmgamer
fix(session): add error logging for failed error response parsing
e11d571
@Kamkmgamer
fix(pty): add error logging for failed process cleanup
e90ba60
@Kamkmgamer
fix(mdns): add error logging for failed bonjour cleanup
9c414d8
@github-actions github-actions Bot added the needs:issue label Jan 13, 2026
@github-actions

github-actions Bot commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr
thdxr force-pushed the dev branch from cbab81f to 2d3c7a0 Compare January 30, 2026 04:50
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@github-actions github-actions Bot mentioned this pull request Mar 12, 2026
fix(opencode): improve linux clipboard error handling and add nix dependencies #17258
Closed
@github-actions

github-actions Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Kamkmgamer
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.