@@ -216,8 +216,20 @@ async void UpdateRepositoryList(object sender, NotifyCollectionChangedEventArgs
216216 HandleClonedRepo ( newrepo ) ;
217217
218218 isCreating = isCloning = false ;
219- var repo = await ApiFactory . Create ( newrepo . CloneUrl ) . GetRepository ( ) ;
220- newrepo . SetIcon ( repo . Private , repo . Fork ) ;
219+
220+ try
221+ {
222+ // TODO: Cache the icon state.
223+ var repo = await ApiFactory . Create ( newrepo . CloneUrl ) . GetRepository ( ) ;
224+ newrepo . SetIcon ( repo . Private , repo . Fork ) ;
225+ }
226+ catch
227+ {
228+ // GetRepository() may throw if the user doesn't have permissions to access the repo
229+ // (because the repo no longer exists, or because the user has logged in on a different
230+ // profile, or their permissions have changed remotely)
231+ // TODO: Log
232+ }
221233 }
222234 // looks like it's just a refresh with new stuff on the list, update the icons
223235 else
@@ -228,8 +240,20 @@ async void UpdateRepositoryList(object sender, NotifyCollectionChangedEventArgs
228240 {
229241 if ( Equals ( Holder . ActiveRepo , r ) )
230242 SelectedRepository = r ;
231- var repo = await ApiFactory . Create ( r . CloneUrl ) . GetRepository ( ) ;
232- r . SetIcon ( repo . Private , repo . Fork ) ;
243+
244+ try
245+ {
246+ // TODO: Cache the icon state.
247+ var repo = await ApiFactory . Create ( r . CloneUrl ) . GetRepository ( ) ;
248+ r . SetIcon ( repo . Private , repo . Fork ) ;
249+ }
250+ catch
251+ {
252+ // GetRepository() may throw if the user doesn't have permissions to access the repo
253+ // (because the repo no longer exists, or because the user has logged in on a different
254+ // profile, or their permissions have changed remotely)
255+ // TODO: Log
256+ }
233257 } ) ;
234258 }
235259 }
0 commit comments