2525import org .apache .commons .lang3 .StringUtils ;
2626import org .eclipse .egit .github .core .User ;
2727import org .eclipse .egit .github .core .client .GitHubClient ;
28- import org .hibernate .HibernateException ;
2928import org .jboss .logging .Logger ;
3029import org .jboss .set .mjolnir .client .exception .ApplicationException ;
3130import org .jboss .set .mjolnir .client .service .GitHubService ;
@@ -114,9 +113,8 @@ public EntityUpdateResult<RegisteredUser> modifyGitHubName(String newGithubName)
114113 logger .warnf ("Validation failure: %s" , validationResult );
115114 return EntityUpdateResult .validationFailure (validationResult );
116115 }
117- } catch (HibernateException e ) {
118- throw new ApplicationException (e );
119- } catch (IOException e ) {
116+ } catch (Exception e ) {
117+ logger .errorf (e , "Failed to set GH username" );
120118 throw new ApplicationException (e );
121119 }
122120 }
@@ -134,7 +132,7 @@ public String subscribe(int teamId) {
134132 return state ;
135133 } catch (IOException e ) {
136134 final String message = "Unable to subscribe user " + githubName + " to team #" + teamId + ": " + e .getMessage ();
137- logger .warnf (message , e );
135+ logger .errorf (message , e );
138136 throw new ApplicationException (message , e );
139137 }
140138 }
@@ -150,6 +148,7 @@ public void unsubscribe(int teamId) {
150148 teamService .removeMembership (teamId , githubName );
151149 logger .infof ("Successfully removed %s from team." , githubName );
152150 } catch (IOException e ) {
151+ logger .errorf (e , "Unable to unsubscribe user " + githubName + " to team #" + teamId );
153152 throw new ApplicationException ("Unable to unsubscribe user " + githubName
154153 + " to team #" + teamId , e );
155154 }
@@ -186,6 +185,7 @@ public List<GithubOrganization> getSubscriptions() {
186185 }
187186 return organizations ;
188187 } catch (IOException e ) {
188+ logger .errorf (e , "Can't obtain membership information from GH API." );
189189 throw new ApplicationException ("Can't obtain membership information from GH API." , e );
190190 }
191191 }
@@ -204,6 +204,7 @@ private String getCurrentUserGitHubName() {
204204 User githubUser = userService .getUserById (gitHubId );
205205 return githubUser .getLogin ();
206206 } catch (IOException e ) {
207+ logger .errorf (e , "Unable to retrieve GH user by his ID: " + gitHubId );
207208 throw new ApplicationException ("Unable to retrieve GH user by his ID: " + gitHubId , e );
208209 }
209210 }
0 commit comments