-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added verbose message for api failure #43
base: master
Are you sure you want to change the base?
Conversation
@@ -411,6 +411,17 @@ $(document).ready(function(){ | |||
$(".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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.