luckyframework / luckyframework/lucky_task

Differentiate between exception and error

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

Nobody has claimed this yet.

Dominant language
Crystal
Stars
8
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Ref: https://github.com/luckyframework/lucky/discussions/1314
Ref: https://github.com/luckyframework/avram/issues/773
Ref: https://github.com/luckyframework/lucky/issues/1463

The idea here is that when you (the developer) are using Lucky, and you use the tools incorrectly, you should be given an error message. When you use the tools correctly, but it just doesn't work, then you should be given an exception.

I'm not totally sold on any single implementation for this, yet; however, my first thought is the distinction between these:

```crystal
# Error
puts "You for got to add something".colorize.red
exit(1)

# Exception
raise "Unable to do that thing"
```

We sort of use a mix of these now, and it's pretty inconsistent.

If valid, print good, else print bad.
https://github.com/luckyframework/lucky/blob/a12ddfb1b9b0edfc6594e0555140f96987fd25ab/tasks/gen/action/action_generator.cr#L20-L25

do thing, rescue and print bad if it fails
https://github.com/luckyframework/lucky/blob/a12ddfb1b9b0edfc6594e0555140f96987fd25ab/tasks/gen/resource/browser.cr#L34-L40

if error print bad, else print good
https://github.com/luckyframework/lucky/blob/a12ddfb1b9b0edfc6594e0555140f96987fd25ab/tasks/gen/page.cr#L21-L26

run through the code and constantly check progress. raise exception at any point
https://github.com/luckyframework/lucky/blob/a12ddfb1b9b0edfc6594e0555140f96987fd25ab/tasks/gen/resource/browser.cr#L90-L101

Contributor guide

No contributing guide indexed for this repository

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 by reading the linked discussions and issues, then compare the referenced generator sections in tasks/gen/action/action_generator.cr, tasks/gen/resource/browser.cr, and tasks/gen/page.cr. Review how each currently reports success, errors, and rescued failures. Done means the project has an agreed distinction and consistent behavior across these task-generation paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal
Domain
cli
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.