luckyframework / luckyframework/avram

Avram::NeedyInitializer#inherit_needs error message is less than helpful.

Open
#632 2 comments 0 reactions 0 assignees View on GitHub
improve error experience
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

This error message is less than helpful. The real error is "that class should be abstract".
```
crystal spec
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'inherit_needs'

Code in macro 'inherited'

Called macro defined in lib/avram/src/avram/needy_initializer_and_delete_methods.cr:15:3

15 | macro inherit_needs

Which expanded to:

> 4 |
> 5 | {% if !@type.ancestors.first.abstract? %}
> 6 | {% for type_declaration in @type.ancestors.first.constant :OPERATION_NEEDS %}
^-------
Error: BUG: DeleteHierarchical(Forum) has no types
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `crystal spec` and `--error-trace`. Read the `inherit_needs` macro in `lib/avram/src/avram/needy_initializer_and_delete_methods.cr` at line 15; done means the failure reports that the class should be abstract instead of the unhelpful missing-types error.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.