Record failure to the DB if an exception is raise here.
Fix string formatting.