Commit 2a4affef authored by Greg Messner's avatar Greg Messner
Browse files

Simplified exception handling and logging of same.

parent 988f71cf
Showing with 3 additions and 19 deletions
+3 -19
package org.gitlab4j.api.systemhooks;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
......@@ -15,9 +14,6 @@ import org.gitlab4j.api.HookManager;
import org.gitlab4j.api.utils.HttpRequestUtils;
import org.gitlab4j.api.utils.JacksonJson;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
/**
* This class provides a handler for processing GitLab System Hook callouts.
*/
......@@ -71,7 +67,6 @@ public class SystemHookManager extends HookManager {
throw new GitLabApiException(message);
}
String errorMessage = null;
try {
SystemHookEvent event;
......@@ -88,22 +83,11 @@ public class SystemHookManager extends HookManager {
fireEvent(event);
} catch (JsonParseException jpe) {
errorMessage = jpe.getMessage();
LOG.warning("Error parsing JSON data, error=" + errorMessage);
} catch (JsonMappingException jme) {
errorMessage = jme.getMessage();
LOG.warning("Error mapping JSON data, error=" + errorMessage);
} catch (IOException ioe) {
errorMessage = ioe.getMessage();
LOG.warning("Error reading JSON data, error=" + errorMessage);
} catch (Exception e) {
errorMessage = e.getMessage();
LOG.warning("Unexpected error reading JSON data, error=" + errorMessage);
LOG.warning("Error processing JSON data, exception=" +
e.getClass().getSimpleName() + ", error=" + e.getMessage());
throw new GitLabApiException(e);
}
if (errorMessage != null)
throw new GitLabApiException(errorMessage);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment