luckyframework / luckyframework/avram

Add `debug_info` to `LuckyRecord::Field`

Open
#15 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

We ran into https://github.com/luckyframework/lucky_record/pull/272#pullrequestreview-141172842 and finding the issue was a bit tricky because it said the Time we were passing was "invalid" but it wasn't clear why.

I think we should have a `debug_info` instance var to LuckyRecord::Field that is an array of strings. This way you could add error messages when parsing that are useful to developers. For example, it would have added: `Invalid ("2018-08-08T16:00:00.000Z"): "Time format did not include time zone and no default location provided"`

@edwardloveall What do you think? This way when someone `p the_field` it will show you more helpful information

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the LuckyRecord::Field implementation and the parsing paths that produce invalid-field errors. Add the requested string-array debug information so parsing context is available when the field is inspected, and verify that p on a field exposes the useful error detail described in the issue.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.