luckyframework / luckyframework/avram

Error experience is close to opaque in creating operations with incorrect argument types

Open
#606 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

The error experience when attempting to create an operation with an incorrect argument type is close to opaque. Even though I've been through this many times, I find it difficult to isolate which argument is wrong out of all of the repeated irrelevant type information. This sets a high bar for newbies and will be cause for rejection of the Lucky platform.

The error here is that Taxonony::Type was used in the model where it should have been Int32.
```
In tasks/db/seed/required_data.cr:45:29

45 | language = SaveTaxonomy.create!(type: Taxonomy::Type::Language, name: "en-US", current_user: user)
^------
Error: no overload matches 'SaveTaxonomy.create!', type: Taxonomy::AvramType, name: String, current_user: User

Overloads are:
- SaveTaxonomy.create!(params, language_tag : String, current_user : User, id : Int64 | Nothing = Nothing.new, created_by_id : User::PrimaryKeyType | Nothing = Nothing.new, created_at : Time | Nothing = Nothing.new, updated_at : Time | Nothing = Nothing.new, type : Taxonomy::Type | Nothing = Nothing.new, parent_id : Taxonomy::PrimaryKeyType | Nothing | Nil = Nothing.new, name : String | Nothing = Nothing.new, new_parent_class : String | Nothing = Nothing.new, new_parent_id : String | Nothing = Nothing.new)
- SaveTaxonomy.create!(language_tag : String, current_user : User, id : Int64 | Nothing = Nothing.new, created_by_id : User::PrimaryKeyType | Nothing = Nothing.new, created_at : Time | Nothing = Nothing.new, updated_at : Time | Nothing = Nothing.new, type : Taxonomy::Type | Nothing = Nothing.new, parent_id : Taxonomy::PrimaryKeyType | Nothing | Nil = Nothing.new, name : String | Nothing = Nothing.new, new_parent_class : String | Nothing = Nothing.new, new_parent_id : String | Nothing = Nothing.new)
- SaveTaxonomy.create!(params : Hash, **named_args)
- Taxonomy::SaveOperation.create!(params : Hash, **named_args)
- Taxonomy::SaveOperation.create!(params, id : Int64 | Nothing = Nothing.new, created_by_id : User::PrimaryKeyType | Nothing = Nothing.new, created_at : Time | Nothing = Nothing.new, updated_at : Time | Nothing = Nothing.new, type : Taxonomy::Type | Nothing = Nothing.new, parent_id : Taxonomy::PrimaryKeyType | Nothing | Nil = Nothing.new, name : String | Nothing = Nothing.new)
- Taxonomy::SaveOperation.create!(id : Int64 | Nothing = Nothing.new, created_by_id : User::PrimaryKeyType | Nothing = Nothing.new, created_at : Time | Nothing = Nothing.new, updated_at : Time | Nothing = Nothing.new, type : Taxonomy::Type | Nothing = Nothing.new, parent_id : Taxonomy::PrimaryKeyType | Nothing | Nil = Nothing.new, name : String | Nothing = Nothing.new)
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure at tasks/db/seed/required_data.cr:45 and inspect the SaveTaxonomy.create! overloads shown in the error. Trace how this operation reports incorrect argument types; done means the message identifies the offending argument without the repeated irrelevant type information.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.