IObservable <Gist> OnCreateGist(object unused) { var newGist = new NewGist { Description = Description, Public = !IsPrivate }; newGist.Files.Add(FileName, SelectedText); return(gistPublishService.PublishGist(apiClient, newGist) .Catch <Gist, Exception>(ex => { if (!ex.IsCriticalException()) { log.Error(ex); var error = StandardUserErrors.GetUserFriendlyErrorMessage(ex, ErrorType.GistCreateFailed); notificationService.ShowError(error); } return Observable.Return <Gist>(null); })); }
IObservable <Gist> OnCreateGist() { var newGist = new NewGist { Description = Description, Public = !IsPrivate }; newGist.Files.Add(FileName, SelectedText); return(gistPublishService.PublishGist(apiClient, newGist) .Do(_ => usageTracker.IncrementCounter(x => x.NumberOfGists).Forget()) .Catch <Gist, Exception>(ex => { if (!ex.IsCriticalException()) { log.Error(ex, "Error Creating Gist"); var error = StandardUserErrors.GetUserFriendlyErrorMessage(ex, ErrorType.GistCreateFailed); notificationService.ShowError(error); } return Observable.Return <Gist>(null); })); }