luckyframework / luckyframework/avram
Add more helpful compiler errors if wrong data types are passed as where query arguments
- Dominant language
- Crystal
- Stars
- 183
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
For example, when passing a `Time::Span` to the `gt` method to build a query:
```cr
BlockQuery.new.time.gt(1.day)
# (should be: BlockQuery.new.time.gt(Time.utc - 1.day))
```
The error is not referencing the `gt` method:
```
In lib/avram/src/avram/type.cr:25:5
25 | parse(value).as(SuccessfulCast).value
^----
Error: no overload matches 'Time::Lucky.parse' with type Time::Span
```
Contributor guide
Research direction
Start by reproducing the BlockQuery.new.time.gt(1.day) example and inspect lib/avram/src/avram/type.cr, especially the parse call shown in the compiler error, along with the gt query entry point. Done means an invalid Time::Span argument produces a compiler error that references gt and explains the expected value, rather than only reporting the failure in Time::Lucky.parse.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100