[misc] Avoid generating useless exceptions