decouple error handling