Encapsulate captured errors a little more cleanly