Skip to content

Commit 5b8f98b

Browse files
author
Max Presman
committed
clean up endpoint error handling
1 parent 6f52a70 commit 5b8f98b

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

src/main/java/com/pubnub/api/endpoints/Endpoint.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,7 @@ public final void async(final PNCallback<Output> callback) {
9797

9898
try {
9999
call = doWork(createBaseParams());
100-
} catch (PubNubException e) {
101-
102-
PubNubException pubnubException = PubNubException.builder()
103-
.pubnubError(PubNubErrorBuilder.PNERROBJ_HTTP_ERROR)
104-
.errormsg(e.getMessage())
105-
.build();
106-
100+
} catch (PubNubException pubnubException) {
107101
callback.onResponse(null, createStatusResponse(PNStatusCategory.PNBadRequestCategory, null, pubnubException));
108102
return;
109103
}
@@ -145,14 +139,7 @@ public void onResponse(final Call<Input> performedCall, final Response<Input> re
145139

146140
try {
147141
callbackResponse = createResponse(response);
148-
} catch (PubNubException e) {
149-
150-
PubNubException pubnubException = PubNubException.builder()
151-
.pubnubError(PubNubErrorBuilder.PNERROBJ_PARSING_ERROR)
152-
.errormsg(e.getMessage())
153-
.statusCode(response.code())
154-
.build();
155-
142+
} catch (PubNubException pubnubException) {
156143
callback.onResponse(null, createStatusResponse(PNStatusCategory.PNMalformedResponseCategory, response, pubnubException));
157144
return;
158145
}
@@ -229,7 +216,6 @@ private PNStatus createStatusResponse(PNStatusCategory category, Response<Input>
229216
pnStatus.clientRequest(response.raw().request());
230217
}
231218

232-
233219
pnStatus.operation(getOperationType());
234220
pnStatus.category(category);
235221
pnStatus.affectedChannels(getAffectedChannels());
@@ -249,7 +235,6 @@ protected final Map<String, String> createBaseParams() {
249235
params.put("auth", pubnub.getConfiguration().getAuthKey());
250236
}
251237

252-
253238
return params;
254239
}
255240

src/main/java/com/pubnub/api/enums/PNLogVerbosity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ public enum PNLogVerbosity {
55
NONE,
66
BODY,
77

8-
98
}

0 commit comments

Comments
 (0)