Centralize error handling