fix: critical bugs and error handling improvements#381
fix: critical bugs and error handling improvements#381Tarquinen merged 7 commits intoOpencode-DCP:devfrom
Conversation
- Add custom error classes for DCP command handling (replaces magic strings) - Validate purgeErrors.turns and turnProtection.turns >= 1 (prevents data loss) - Replace silent error swallowing with console.error fallback in logger - Add config validation warning for invalid turns values Fixes: - Magic string error control flow anti-pattern - Potential immediate pruning of all errors with turns=0 - Silent error hiding in logger methods
|
Hey, thanks for the help, couple questions: Whats the point of the custom error classes? The error strings don't matter, they're not used anywhere they're just thrown to interrupt an opencode process. Why only add numeric validation to some of the config fields? Should probably be done to everything? Doesn't console.error log to the TUI? |
Changes: - Remove custom error classes - revert to simple error strings (maintainer confirmed strings aren't matched, just used for control flow) - Add devError method to logger for developer-only errors (no TUI output) - Expand numeric validation to all fields: - nudgeFrequency: validate >= 1, clamp at runtime - turnProtection.turns: validate >= 1 (already has runtime check) - purgeErrors.turns: already validated >= 1 - Add runtime clamping for nudgeFrequency in inject.ts Fixes maintainer concerns: 1. Custom error classes were overkill for simple control flow 2. Numeric validation now covers all numeric config fields
|
Thanks for the feedback! I've addressed your concerns: 1. Custom error classes - You're right, they were overkill. I've removed them and reverted to simple error strings for control flow. The strings aren't matched anywhere, so custom classes added unnecessary complexity. 2. Numeric validation - Fair point! I've expanded validation to all numeric fields:
Also added runtime clamping ( 3. console.error to TUI - Good catch. I've added a Updated the PR with these changes. Let me know if anything else needs adjustment! |
|
I don't really get it, there's still a console.error? Won't that go to the TUI? did you try triggering it to verify? Also the format check is failing, run bun run format |
|
Looks good, thank you for the help! |
…ents fix: critical bugs and error handling improvements
Fixes: