luckyframework / luckyframework/avram

Save constructor parameters as instance variables in AvramError subclasses

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

Description

I would like to localize error messages in `show.cr`, however e.g. `Avram::InvalidOperationError` does not allow me to access which operation failed as it only saves an English error message in `@message`.

If the operation also was saved in an instance variable, I could access it in `show.cr` and create a nice localized error message. The same holds true for other subclasses of `AvramError`, e.g. `RecordNotFoundError` not saving the table and the id in instance variables.

If acceptable, I am willing to create a PR for the `AvramError` subclasses to save all constructor parameters in instance variables to make them accessible for localization.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the AvramError subclasses mentioned in the issue, especially InvalidOperationError and RecordNotFoundError, and review how show.cr currently receives their errors. Determine which constructor parameters need to remain accessible for localization, then verify that each affected subclass exposes them without losing its existing message behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.