catch errors in tests