MySQL failed query logs

Is there a way to log only the failed SQLs?
Only the queries that were attempted and had errors in the SQL strings supplied.

What server-side language is in use?

Well, it does not require any server side language, as I am searching for an option to tweak mysql configurations for logging queries that failed only.
I mean, successful queries executed need not to be logged in.

We can log the successful queries in my.ini.
But any luck for the unsuccessful queries that the database server received?