Skip to content

Commit 1dd9b28

Browse files
authored
Remove code for nested RequestNotOkException (#99)
Nesting these doesn't make much sense. Let's remove the exception code and refactor the only usage to just re-throw the already existing exception.
1 parent a63577c commit 1dd9b28

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

src/main/java/com/spotify/github/v3/clients/RepositoryClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ public CompletableFuture<Void> createWebhook(
205205
return null;
206206
}
207207

208-
throw new RequestNotOkException(
209-
e1.path(), e1.statusCode(), "Failed creating a webhook: " + request, e);
208+
throw e1;
210209
}
211210

212211
throw new CompletionException(e);

src/main/java/com/spotify/github/v3/exceptions/ReadOnlyRepositoryException.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,4 @@ public class ReadOnlyRepositoryException extends RequestNotOkException {
3232
public ReadOnlyRepositoryException(final String path, final int statusCode, final String msg) {
3333
super(path, statusCode, msg);
3434
}
35-
36-
/**
37-
* Instantiates a new Read only repository exception.
38-
*
39-
* @param path the path
40-
* @param statusCode the status code
41-
* @param msg the msg
42-
* @param cause the cause
43-
*/
44-
public ReadOnlyRepositoryException(
45-
final String path, final int statusCode, final String msg, final Throwable cause) {
46-
super(path, statusCode, msg, cause);
47-
}
4835
}

src/main/java/com/spotify/github/v3/exceptions/RequestNotOkException.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,6 @@ public RequestNotOkException(final String path, final int statusCode, final Stri
5959
this.msg = msg;
6060
}
6161

62-
/**
63-
* Response to request came back with non-2xx status code
64-
*
65-
* @param path URI path
66-
* @param statusCode status of repsonse
67-
* @param msg response body
68-
* @param cause exception cause
69-
*/
70-
public RequestNotOkException(
71-
final String path, final int statusCode, final String msg, final Throwable cause) {
72-
super(decoratedMessage(path, statusCode, msg), cause);
73-
this.statusCode = statusCode;
74-
this.path = path;
75-
this.msg = msg;
76-
}
77-
7862
/**
7963
* Get the raw message from github
8064
*

0 commit comments

Comments
 (0)