3 ms·
`try` is bad for a number of reasons. Because itll never throw an error, you see it hiding issues. And I keep seeing colleagues writing `hash.try(:[], :some_k
by matthewrudy 11y ago
`try` is bad for a number of reasons.
Because itll never throw an error, you see it hiding issues.
And I keep seeing colleagues writing `hash.try(:[], :some_key)`
`try!` is better.
But I'll stick to `&.` from now on.
- kelseydh 11y agoUsing `try` is definitely a code smell, but unfortunately it's often a necessary one in production environments that have seen some wear and tear in the integrity of their database structures.