How to detect errors in :gen_statem?

The fact is if I don’t trap exit or monitor the process I don’t catch the error .
But thanks for the tip