#12 better logging and error trace