PDOException - Get error instead rendering error page

Hello.
I need to check sql, and got false or error code/message to controller instead rendering error page when try to execute() sql. I’m not found it in documentations (Error & Exception Handling), how I can do it?
Thank you.

CakePHP 3.8

Is this a raw SQL query your trying to run or a Cake Query?

If it’s raw SQL you could try and run it in some other tool to see what you get. I happen to use SequelPro but have no recommendations to give.

If it’s a Cake query, once you’ve defined it and before you force it to execute you can debug the query to the screen to see what it looks like.