Add framework for error handling