@@ -73,12 +73,11 @@ public final Call<Input> async(final PNCallback<Output> callback) {
7373 } catch (PubnubException e ) {
7474
7575 PubnubException pubnubException = PubnubException .builder ()
76- .pubnubError (PubnubError .PNERROBJ_INVALID_ARGUMENTS )
76+ .pubnubError (PubnubError .PNERROBJ_HTTP_ERROR )
7777 .errormsg (e .getMessage ())
7878 .build ();
7979
80- PNStatus pnErrorStatus = PNStatus .builder ().build ();
81- callback .onResponse (null , createStatusResponse (null , pubnubException ));
80+ callback .onResponse (null , createStatusResponse (PNStatusCategory .PNBadRequestCategory , null , pubnubException ));
8281 }
8382
8483 call .enqueue (new retrofit2 .Callback <Input >() {
@@ -105,7 +104,7 @@ public void onResponse(final Call<Input> call, final Response<Input> response) {
105104 .statusCode (response .code ())
106105 .build ();
107106
108- callback .onResponse (null , createStatusResponse (response , ex ));
107+ callback .onResponse (null , createStatusResponse (PNStatusCategory . PNBadRequestCategory , response , ex ));
109108 return ;
110109 }
111110
@@ -119,11 +118,11 @@ public void onResponse(final Call<Input> call, final Response<Input> response) {
119118 .statusCode (response .code ())
120119 .build ();
121120
122- callback .onResponse (null , createStatusResponse (response , pubnubException ));
121+ callback .onResponse (null , createStatusResponse (PNStatusCategory . PNBadRequestCategory , response , pubnubException ));
123122 return ;
124123 }
125124
126- callback .onResponse (callbackResponse , createStatusResponse (response , null ));
125+ callback .onResponse (callbackResponse , createStatusResponse (null , response , null ));
127126 }
128127
129128 @ Override
@@ -135,7 +134,7 @@ public void onFailure(final Call<Input> call, final Throwable throwable) {
135134 .errormsg (throwable .getMessage ())
136135 .build ();
137136
138- callback .onResponse (null , createStatusResponse (null , pubnubException ));
137+ callback .onResponse (null , createStatusResponse (PNStatusCategory . PNBadRequestCategory , null , pubnubException ));
139138
140139 }
141140 });
@@ -167,20 +166,6 @@ private PNStatus createStatusResponse(PNStatusCategory category, Response<Input>
167166 pnStatus .operation (getOperationType ());
168167 pnStatus .category (category );
169168
170- /*
171- if (response != null) {
172- pnErrorStatus.setStatusCode(response.code());
173- }
174-
175- pnErrorStatus.setOperation(getOperationType());
176- pnErrorStatus.setError(isError);
177-
178- if (isError) {
179- PNErrorData errorData = new PNErrorData(null, throwable);
180- pnErrorStatus.setErrorData(errorData);
181- }
182- */
183-
184169 return pnStatus .build ();
185170 }
186171
0 commit comments