Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubServiceException.java')
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubServiceException.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubServiceException.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubServiceException.java
new file mode 100644
index 00000000..3e9a51c2
--- /dev/null
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubServiceException.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * David Green <david.green@tasktop.com> - initial contribution
+ * Christian Trutz <christian.trutz@gmail.com> - initial contribution
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial contribution
+ *******************************************************************************/
+package org.eclipse.mylyn.github.internal;
+
+import org.apache.commons.httpclient.StatusLine;
+
+/**
+ * Exception generated by the GitHubService
+ */
+public class GitHubServiceException extends Exception {
+
+ /**
+ * Auto generated serialVersionUID
+ */
+ private static final long serialVersionUID = -6287902058352190022L;
+
+ private int httpStatusCode = Integer.MIN_VALUE;
+
+ /**
+ * Constructor for the GitHubServiceException
+ *
+ * @param exception
+ * - Exception to wrap around
+ */
+ protected GitHubServiceException(final Exception exception) {
+ super(exception);
+ }
+
+ protected GitHubServiceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected GitHubServiceException(String message) {
+ super(message);
+ }
+
+ protected GitHubServiceException(StatusLine statusLine) {
+ this(String.format("HTTP %s: %s",statusLine.getStatusCode(),statusLine.getReasonPhrase()));
+ httpStatusCode = statusLine.getStatusCode();
+ }
+
+ /**
+ * the HTTP status code, or -1 if unknown or not applicable.
+ */
+ public int getHttpStatusCode() {
+ return httpStatusCode;
+ }
+}

Back to the top