Skip to content

Commit 090a16f

Browse files
committed
Add logging messages in GitHubServiceImpl
1 parent 052b035 commit 090a16f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/org/jboss/set/mjolnir/server/service/GitHubServiceImpl.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.commons.lang3.StringUtils;
2626
import org.eclipse.egit.github.core.User;
2727
import org.eclipse.egit.github.core.client.GitHubClient;
28-
import org.hibernate.HibernateException;
2928
import org.jboss.logging.Logger;
3029
import org.jboss.set.mjolnir.client.exception.ApplicationException;
3130
import 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

Comments
 (0)