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

Commit fa9cc6f

Browse files
Shortening the error message for 'too many private repos'
1 parent bd9a081 commit fa9cc6f

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

2526
[SerializeField] private string username;
2627
[SerializeField] private string[] owners = { OwnersDefaultText };
@@ -235,11 +236,11 @@ public override void OnGUI()
235236
Description = cleanRepoDescription
236237
}, (repository, ex) =>
237238
{
238-
Logger.Trace("Create Repository Callback");
239-
240239
if (ex != null)
241240
{
242-
error = ex.Message;
241+
Logger.Error(ex, "Repository Create Error Type:{0}", ex.GetType().ToString());
242+
243+
error = GetPublishErrorMessage(ex);
243244
isBusy = false;
244245
return;
245246
}
@@ -251,6 +252,8 @@ public override void OnGUI()
251252
return;
252253
}
253254

255+
Logger.Trace("Repository Created");
256+
254257
GitClient.RemoteAdd("origin", repository.CloneUrl)
255258
.Then(GitClient.Push("origin", Repository.CurrentBranch.Value.Name))
256259
.ThenInUI(Finish)
@@ -265,6 +268,16 @@ public override void OnGUI()
265268
EditorGUI.EndDisabledGroup();
266269
}
267270

271+
private string GetPublishErrorMessage(Exception ex)
272+
{
273+
if (ex.Message.StartsWith(PublishLimtPrivateRepositoriesError))
274+
{
275+
return PublishLimtPrivateRepositoriesError;
276+
}
277+
278+
return ex.Message;
279+
}
280+
268281
public override bool IsBusy
269282
{
270283
get { return isBusy; }

0 commit comments

Comments
 (0)