Compile trap-error using a guard expression with delayed handler evaluation

This may provide a small speed gain.