Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 1c46709

Browse files
Merge branch 'fixes/long-publish-error-message' into fixes/api-failure-switch-auth-view
2 parents 380ede9 + fa9cc6f commit 1c46709

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/PublishView.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class PublishView : Subview
2121
private const string RepositoryNameLabel = "Repository Name";
2222
private const string DescriptionLabel = "Description";
2323
private const string CreatePrivateRepositoryLabel = "Create as a private repository";
24+
private const string PublishLimtPrivateRepositoriesError = "You are currently at your limt of private repositories";
2425
private const string AuthenticationChangedMessageFormat = "You were authenticated as \"{0}\", but you are now authenticated as \"{1}\". Would you like to proceed or logout?";
2526
private const string AuthenticationChangedTitle = "Authentication Changed";
2627
private const string AuthenticationChangedProceed = "Proceed";
@@ -252,11 +253,11 @@ public override void OnGUI()
252253
Description = cleanRepoDescription
253254
}, (repository, ex) =>
254255
{
255-
Logger.Trace("Create Repository Callback");
256-
257256
if (ex != null)
258257
{
259-
error = ex.Message;
258+
Logger.Error(ex, "Repository Create Error Type:{0}", ex.GetType().ToString());
259+
260+
error = GetPublishErrorMessage(ex);
260261
isBusy = false;
261262
return;
262263
}
@@ -268,6 +269,8 @@ public override void OnGUI()
268269
return;
269270
}
270271

272+
Logger.Trace("Repository Created");
273+
271274
GitClient.RemoteAdd("origin", repository.CloneUrl)
272275
.Then(GitClient.Push("origin", Repository.CurrentBranch.Value.Name))
273276
.ThenInUI(Finish)
@@ -282,6 +285,16 @@ public override void OnGUI()
282285
EditorGUI.EndDisabledGroup();
283286
}
284287

288+
private string GetPublishErrorMessage(Exception ex)
289+
{
290+
if (ex.Message.StartsWith(PublishLimtPrivateRepositoriesError))
291+
{
292+
return PublishLimtPrivateRepositoriesError;
293+
}
294+
295+
return ex.Message;
296+
}
297+
285298
public override bool IsBusy
286299
{
287300
get { return isBusy; }

0 commit comments

Comments
 (0)