better gist error handling