luckyframework / luckyframework/avram
Improve preloading error message
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
When you have `lazy_load_enabled` set to true, and you have a missing preload, you get a nice error that tells you which preload method you need to call, and where it should be added in.
One thing that could help bump that up even more would be an extra message that mentions if you need a nested preload like in this case.
```crystal
post = PostQuery.new.preload_author.first
# you also need to preload comments here
# error says "call preload_comments"
post.author.comments
post = PostQuery.new.preload_author(AuthorQuery.new.preload_comments).first
# now this works
post.author.comments
```
Contributor guide
Research direction
Reproduce the nested preload example with lazy_load_enabled set to true and trace the existing missing-preload error path. Compare the preload_author and nested preload_comments cases, then verify that the error explains the nested preload requirement and that the second example continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100