luckyframework / lucky

A full-featured Crystal web framework that catches bugs for you, runs incredibly fast, and helps you write code that lasts.
https://luckyframework.org
MIT License
2.59k stars 156 forks source link

Ensure actions can have early returns #1857

Closed jwoertink closed 6 months ago

jwoertink commented 6 months ago

Purpose

Fixes #1843

Description

This may not actually have been a problem to start and possibly just something weird we had in our app ref; however, I decided to still make this change anyway. By moving the call body in to a separate method, the compile-time error is a lot more accurate. Though, it's not as pretty as before, I think the clarity and accuracy outweighs the custom error message.

Also by adding a few comments above the method, you get a little bit of documentation, and the actual action that's failing which should lead you to a fix a bit quicker.

Screenshot from 2024-03-24 16-04-41

See #1843 for more info on the error message change

Checklist