Skip to content

fix: wrap JSON.parse in ghJson/ghJsonLines with contextual error messages - #16

Merged
steipete merged 2 commits into
openclaw:mainfrom
dinakars777:fix/gh-json-parse-error-handling
Apr 27, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
dinakars777:fix/gh-json-parse-error-handling

Conversation

@dinakars777

Copy link
Copy Markdown
Contributor

Summary

  • Wrap JSON.parse in ghJson with try-catch, re-throwing with command context
  • Wrap JSON.parse in ghJsonLines per-line with try-catch, re-throwing with parse error context

Motivation

Fixes #15

If GitHub returns malformed JSON (e.g., HTML during an outage), the error now surfaces with context rather than crashing the run with an opaque parse error.

dinakars777 and others added 2 commits April 27, 2026 05:52
…ages

Handle malformed GitHub API responses gracefully by catching JSON.parse
errors and re-throwing with the failing command context.
@steipete
steipete force-pushed the fix/gh-json-parse-error-handling branch from 93e05a2 to e354d8c Compare April 27, 2026 04:55
@steipete
steipete merged commit c13ab0d into openclaw:main Apr 27, 2026
valkyriweb referenced this pull request in valkyriweb/clawsweeper May 14, 2026
Upstream clawsweeper hardcodes forced_login_method=\"api\" because
openclaw runs with OPENAI_API_KEY. Our valkyriweb fork uses Luke ChatGPT
Max subscription via ~/.codex/auth.json (subscription mode in
setup-codex). The hardcoded \"api\" forces codex into API-key mode and
collides with the ChatGPT JWT in auth.json:

  API key login is required, but ChatGPT is currently being used.
  Logging out.

ForcedLoginMethod enum is {chatgpt, api}. Flipping to chatgpt for our
trial. If we ever wire this fork to a real API key, revisit and make it
env-var driven.

Refs:
- /Users/luke/Projects/oss/codex/codex-rs/protocol/src/config_types.rs
- valkyriweb/clawsweeper run 10 (#16 review hit this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ghJson/ghJsonLines: JSON.parse calls without try-catch risk uncaught exceptions

2 participants