I don't know a way to do it.
But one easy way would be to use a Stored Procedure and forget about the trigger.
In the Procedure, you would attempt the INSERT and, if you get an error from it, then do the other operation (e.g, put data into another table).
I think triggers are over-used and stored procedures are under-used, especially with MySQL.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.