3 ms·
I generally am picky on my try/catch implementations... I use it way more often on the backend (PHP/laravel) than front. Though I will tap into then/catch on as
by gremlinsinc 8y ago
I generally am picky on my try/catch implementations... I use it way more often on the backend (PHP/laravel) than front. Though I will tap into then/catch on async functions which I guess is built-in try/catches.
On the backend I mostly do try/catch when I have a bunch of things tied together in a db transaction... If any part of the commit fails or anything errors at all the whole thing will rollback. Esp. handy when doing multiple relationship attaching in one go.
Also it comes in handy when dealing with API's and things, but for most scenarios it's not needed too often. But I also don't test every little thing, I believe moderation in all things including try, catch, testing. lol.