I have some checks to do before returning a response to the user in controller: checking file existence in S3, checking some DB fields, checking results from external API’s. My question, how to best arrange the checks? I can use nested case statements but that does not look good. Any ideas?! Thank you.
with/1 is especially used instead of nested case statements!
3 Likes
with
is definitely a good place to start, especially if your checks make sense as a sequence of logical operations.
There’s also the catch
/throw
mechanism, but it can turn your code into spaghetti pretty quickly.
1 Like