error handling broken out into module