luckyframework / luckyframework/avram

Save error doesn't give user a clue

Open
#646 2 comments 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

https://github.com/luckyframework/avram/blob/02496a12c817e2fdfcf6d55834e1380afabe6e2d/src/avram/save_operation.cr#L324

This renders as:
```
Unhandled exception: Could not perform RegisterUser.

▸ save_user_options: failed
(Avram::InvalidOperationError)
from lib/avram/src/avram/save_operation.cr:322:7 in 'save!'
from lib/shield/src/presets/user.cr:23:1 in 'create!'
from tasks/db/seed/required_data.cr:35:5 in 'call'
```

The problem was a missing field after a migration. So, Postgres probably had something to say. But no clue was passed to the user.

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

Start in src/avram/save_operation.cr around line 324 and inspect how the save! failure becomes InvalidOperationError. Reproduce the missing-field-after-migration case, then verify that the underlying Postgres clue is preserved in the user-facing error output.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgres
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.