Skip to content

improve errors - #12

Merged
katlasik merged 4 commits into
mainfrom
improve_errors
Nov 3, 2025
Merged

katlasik merged 4 commits into
mainfrom
improve_errors

Conversation

@katlasik

@katlasik katlasik commented Nov 2, 2025

Copy link
Copy Markdown
Owner
  • Improve error messages with field names and annotation context
  • Add customizable error printer with table format

- Add DecodingContext to pass field name and annotations through decode chain
- Update ConfigError types to include field names (Missing, Invalid, Other)
- Change error messages to indicate which annotation failed (env var or system property)
- Update all ConfigDecoder implementations to accept DecodingContext parameter
- Modify ConfigReader.read() to accept field name for better error reporting
- Update all tests to reflect new error message format
- Add .gitignore entries for CLAUDE.md and .claude directory
- Add ErrorPrinter trait for flexible error formatting
- Implement TablePrinter with ASCII box drawing for readable error display
- Implement DefaultPrinter maintaining backward compatibility with getMessage
- Add print method to ConfigError accepting ErrorPrinter via context parameters
- Refactor TablePrinter to use functional style (foldLeft, map, flatMap)
- Update ConfigError.invalid to include fieldName parameter for better context
- Add comprehensive tests with full message assertions
- Document error handling in README with usage examples
- Introduce FieldPath case class to represent hierarchical field paths
- Add string interpolator (path"foo.bar") for convenient FieldPath creation
- Replace fieldName: String with fieldPath: FieldPath in ConfigError types
- Update DecodingContext to use FieldPath instead of String
- Thread parent field path through ConfigLoader.load and deriveProduct
- Update TablePrinter to display dotted paths (e.g., "dbConfig.host")
- Increase TablePrinter column widths for better nested field display
- Update all error construction to use FieldPath throughout codebase
@katlasik
katlasik merged commit 38f01be into main Nov 3, 2025
1 check passed
@katlasik
katlasik deleted the improve_errors branch November 3, 2025 09:12
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.

1 participant