Fix error handling, SQLite safety, and API naming#4
Merged
simonovic86 merged 1 commit intomainfrom Mar 10, 2026
Merged
Conversation
Fix silent error handling across storage layers and typed commands: - SQLite Create/Update now check json.Marshal errors instead of discarding - PostgreSQL postgresTx Create/Update same fix - TypedCommand.Recover() returns unmarshal error instead of silently skipping Improve SQLite connection safety: - Add SetMaxOpenConns(1) to prevent SQLITE_BUSY errors - Add PRAGMA busy_timeout=5000 for lock wait tolerance Fix API naming to follow Go conventions: - Registry.Register() now returns error (was panic) - Registry.MustRegister() now panics on error (Go Must* convention) - Add Registry.Overwrite() for silent replacement (old MustRegister behavior) - Typed() now returns (Spec, error); add MustTyped() for panic variant - Add WithDefaultPeriod() option, deprecate WithDefaultRepeatInterval() - Add Spec builders: WithPeriod, WithCron, WithSequence, WithDeadlineAt BREAKING CHANGES: - Typed() signature changed from Spec to (Spec, error) - Registry.Register() returns error instead of panicking - Registry.MustRegister() now panics on duplicate (was silent overwrite) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
Error Handling Improvements
Register()to returnerrorinstead of panicking; addedMustRegister()for panic behavior and newOverwrite()for testingTyped()now returns(Spec, error)instead of silently failing; addedMustTyped()for panic behaviorMustRegister()for registrationSQLite Safety Fixes
MaxOpenConns(1)to avoid SQLITE_BUSY errorsPRAGMA busy_timeout=5000to wait for locks instead of failing immediatelyCreate()method (renamederrtoexecErr)API Naming & Deprecation
WithDefaultRepeatInterval()toWithDefaultPeriod()for consistency; kept old name as deprecated aliasWithPeriod(),WithCron(),WithSequence(),WithDeadlineAt()Register()call to useMustRegister()MustTyped()instead ofTyped()Test Coverage
Register(),MustRegister(),Overwrite()Typed(),MustTyped(), and recovery error handling