Uncatched exception
Closed this issue · 6 comments
Is it possible that the actor doesn't catch "504 Gateway Time-out" exception?
Code:
if (res.isError()){ responseContext.put(url, new String( "{'error':'" + res.getErrorMessage() +"'}")); JSONObject errorJson = new JSONObject(); errorJson.put("time", new Date()); errorJson.put("url", url); errorJson.put("errorMsg", res.getErrorMessage()); parallecErrors.add(errorJson); } else{ if (responseContent.contains("504 Gateway Time-out")){ System.out.println("**********"); System.out.println(res); System.out.println(responseContent); System.out.println("**********"); } responseContext.put(url, responseContent); }
Console (note that you see rendered HTML code, the response string is pure HTML):
SingleTaskResponse [request=TaskRequest [actorMaxOperationTimeoutSec=600, resourcePath=/v3/analyze?token=ae5679ee0686b8ca1033e6d4dc28ffc6&discussion=false&mode=product&url=http%3A%2F%2Fwww.gamepro.de%2Fplaystation%2Fspiele%2Fps3%2Fsniper-ghost-warrior-2%2Fartikel%2Fsniper_ghost_warrior_2_siberian_strike_dlc_im_test%2C47238%2C3011024.html, requestContent=, httpMethod=GET, pollable=false, httpHeaderMap={}, protocol=http, host=API_8350, hostUniform=api.diffbot.com, port=80, sshMeta=null], responseContent=
<title>504 Gateway Time-out</title>504 Gateway Time-out
nginx/1.8.1 , receiveTime=2016.11.01.00.52.10.769+0200, receiveTimeInManager=2016.11.01.00.52.10.769+0200, error=false, errorMessage=null, stackTrace=null, statusCode=504 Gateway Time-out, operationTimeMillis=60573, pollingHistoryMap={}] <title>504 Gateway Time-out</title>
504 Gateway Time-out
nginx/1.8.1
hi @tomerbal , do you mean you want to avoid this exception? or you mean you just want to ignore this error and mark it as successful?
I would like to treat it as any other exception being thrown by the Actor. In this case if (res.isError()) return false.
@tomerbal Could you please use boolean healthy = gap.getStatusCodeInt() == 200
? the code should be 504
What is the gap Object? Where can I get it from?
I mean ResponseOnSingleTask res
in the onComplete function
Thanks