untested cleanest error handling