8000 Differentiate between exception and error · Issue #8 · luckyframework/lucky_task · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Differentiate between exception and error #8
Open
@jwoertink

Description

@jwoertink

Ref: luckyframework/lucky#1314
Ref: luckyframework/avram#773
Ref: luckyframework/lucky#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:

# 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0