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.57k stars 156 forks source link

Better compile time error for link helper usage and actions that require params #1734

Open matthewmcgarvey opened 1 year ago

matthewmcgarvey commented 1 year ago

Purpose

Fixes https://github.com/luckyframework/lucky/issues/1652

Description

This is an attempt at making link helper compile time errors better when passing in a Lucky::Action that needs params.

Screen Shot 2022-09-13 at 1 01 09 AM'

🙏 It's really late. I got the code working, but I hope you can see that the error message is a joke at the moment. Please help me with that. I am even wondering if we can access the action class in the error message to print out what is required? That might be a stretch too far though. Another thing I didn't look into is if this is useful anywhere else. I'd check anywhere we currently use Lucky::Action.class

jwoertink commented 1 year ago

love it. ship it! also, do better :joy:

jwoertink commented 1 year ago

The code looks ok, but I would like to give this a shot with Crystal 1.6 first to see if the errors are going to change anyway. Actually... maybe it won't matter since it's not really the link that's wrong, but the action.. :thinking: I'll think about an error message in the meantime.