Helper library with common error handling code.