Comments (3)
Just another thought on this, that {{ body }}
line could just be moved to a different method like call_body
or something. That actually might be the better solution.
private def call_body : Lucky::Response
{{ body }}
end
def call
#...
%response = if %pipe_result.is_a?(Lucky::Response)
%pipe_result
else
call_body
end
#...
end
from lucky.
After a bunch of poking around... I can't get this to happen again. We tried using this in our app, and kept running in to issues. We ended up having to account for every single condition branch. I just tried to recreate this in Lucky, and I'm unable to.
I did check out my previous idea though, and I think this change may still be worth it...
Moving the {{ body }}
to a separate method means that Crystal will catch your missing response with this:
This is in comparison to what Lucky does now which is:
Granted, the second one looks a lot nicer, and gives you some direction as to how to fix the error, but it doesn't tell you where the error is. For a new person, this error really isn't helpful because you may have just added 20 actions without checking and then ran this and have no clue where to fix the error.
For fun, I added #{@type}
to my error to see if a simple fix to the pretty error could be done...
Notice it says Multiple::Index
is the action where it failed.... but the action I actually messed up was Tests::MultiConditionWithEarlyReturn
. I don't know why it thinks it's an action in a spec that I'm not even working near 🤷♂️
So I guess what I'm saying is, making this change is probably better anyway.
from lucky.
I feel like that's a bit of the best of both worlds scenario
from lucky.
Related Issues (20)
- Add more info to the RequestCompleteEvent
- Custom param parser escape hatch
- Add some sort of `with_keys` option to `send_json` HOT 1
- Add an option to configure size of secret key
- Add the compile time to the watcher in development
- Add format flag to `lucky routes` for outputting alternate formats
- Adding a strip_tags helper with allow list capabilities
- Add native ECR support
- Add distance_of_time_in_words that takes a Time::Span
- Add Date header to responses
- Create handler to mutate param key names
- Action based rate limiting HOT 2
- Improve the error output when newbie user forget settings LUCKY_ENV to production.
- Compile error using Crystal nightly
- gen.action.browser doesn't mention the --with-page flag
- Changing the DEV_PORT doesn't update the watcher reload_port shown in terminal
- Compile time should reset when recompiling
- Building a route with array params doesn't work HOT 1
- redirect_back not work as expected as previous_url
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lucky.