Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added verbose message for api failure #43

wants to merge 1 commit into from

Conversation

adi8
Copy link

@adi8 adi8 commented Nov 27, 2016

No description provided.

@@ -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.
Copy link
Owner

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.

Copy link
Author

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.

Copy link
Owner

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.

Copy link
Author

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)

Copy link
Author

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?

Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants