0

I have noticed one thing in all core files: all DB related operations are not in try-catch block.

So please suggest me whether it's good practice to put SELECT, UPDATE, INSERT query in try catch block.

2

It's good practice to put any code that could potentially throw an exception in a try...catch (not just in Drupal-related code, and not just in PHP).

So yes, it's good practice to put your database queries in a try...catch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.