wrap logging errors
Dunno what I did here but it looks useful