Added verbose message for api failure#43
Added verbose message for api failure#43adi8 wants to merge 1 commit intosahildua2305:masterfrom adi8:master
Conversation
| $(".error-message").html(response.run_status.stderr); | ||
| } | ||
| } | ||
| // To handle case when hackerearth api doesn't return a valid response. |
There was a problem hiding this comment.
@adi8 this code block should be when ajax request fails. You have put it under success callback function.
There was a problem hiding this comment.
I put it in the success callback as the ajax call does succeed with a 200 OK status. It's just that it doesn't return a valid response. I can add the code in the failure call back as well if you want.
There was a problem hiding this comment.
How do you know it succeeds? Did you check how ajax behaves when the server times out? We need to consider that as well.
There was a problem hiding this comment.
The response which consists the "Error code: 1200" as its compile status, is a success as the API informs us about its inability to compile the code sent to it. Also when this response is returned by the API we see "Error code: 1200" in the output box, which would not be the case if the ajax request failed. (If it did fail we would get a "Server couldn't complete request. Please try again!" message)
There was a problem hiding this comment.
As to "how ajax behaves when the server times out", do you mean when we run a code that crosses the time limit or when the server crashes or something?
There was a problem hiding this comment.
@adi8 yes, I was referring to the case when the server crashes and doesn't return any response within the timeout limit.
No description provided.