feat: Add error logging for bulk operations and model preparation#273
Conversation
|
I might leave it to someone who has a working project that targets Explorer 4.x to
|
|
Thanks for the pull request! 🙏 To manage expectations, it might take at least a week before I have time to properly review this. |
…reparation - Log Elasticsearch bulk operation errors with detailed context including operation type, index, document ID, and full error chains - Add error handling in BulkUpdateOperation.modelToData() to catch and log toSearchableArray() and prepare() method failures - Include stack traces and model context in error logs for better debugging - Allow bulk operations to continue processing other models when individual models fail - Resolves silent failure issues where PHP errors in toSearchableArray() were not visible Fixes issue where errors in model preparation during indexing would fail silently, making debugging difficult for applications consuming this package.
f71aa46 to
d80762f
Compare
|
@Jeroen-G
|
Breaking Changes SummaryThis PR introduces breaking changes to several class constructors and method signatures: Constructor Changes (Required Logger Parameter)
Method Signature Changes
Impact: Users who manually instantiate these classes, extend them, or call the static modelToData() method will need to update their code. Suggested Approach Pros: Fully backwards compatible, seamless upgrade path Alternatives @Jeroen-G |
This is what I would prefer! 👏 There is only logging if someone configures it, and it won't break existing apps that manually interact with those classes (as I know some projects do). Changes to private methods are free to break BC, there's a reason they are private. |
This removes breaking changes by making the LoggerInterface parameter optional in BulkUpdateOperation, ElasticDocumentAdapter, and ElasticEngine constructors. When no logger is provided, a NullLogger is used as the default. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These assertions ensure mutation testing catches when the error context keys are removed, preventing the ArrayItem mutation from escaping. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Ready for review @Jeroen-G |
…operation-error-logging
|
Is anything holding this up @Jeroen-G? |
|
My motivation 🙈 |
|
Thanks a lot for your time, work and certainly patience! If you could give this a quick test with requiring |
Add error logging for bulk operations and model preparation
Fixes issue where errors in model preparation during indexing would fail silently, making debugging difficult for applications consuming this package.
Solution to the issue described in both #221 and #267