In MySQL 5.5: can I capture the output of SHOW ERRORS?
Use

SELECT * 
FROM sys.statements_with_errors_or_warnings 
WHERE last_seen &gt; NOW() - INTERVAL ??? MINUTE;


Set a reasonable time limit.

Or query to performance_schema, tables events_statements_current, events_statements_history and events_statements_history_long.