Better error handling for oauth