-
Notifications
You must be signed in to change notification settings - Fork 63
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
Making error responses more verbose. #73
Conversation
78e4f46
to
916b682
Compare
@@ -15,7 +15,7 @@ def main(ctx): | |||
""" |
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.
@isht3 I think we should also add the details about the CHALLENGE
& PHASE
keywords, so that the end user knows that we are referring to the challenge id and phase id here.
@RishabhJain2018 Yes, agreed. |
916b682
to
b4b93b4
Compare
@RishabhJain2018 Changed! |
@@ -224,7 +224,8 @@ def display_challenge_phase_list(challenge_id): | |||
except requests.exceptions.HTTPError as err: | |||
if (response.status_code in EVALAI_ERROR_CODES): | |||
validate_token(response.json()) | |||
echo(style("Error: {}".format(response.json()["error"]), fg="red", bold=True)) | |||
echo(style("\nError: {}".format(response.json()["error"]), fg="red", bold=True)) |
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.
A better way to get the error message would be response.json().get("error", "{0} error".format(response.status_code))
.
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.
@varunagrawal It is repeated throughout the code, wouldn't it be better to solve it as a different issue?
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.
Yeah guess that makes sense.
evalai/utils/submissions.py
Outdated
echo(style("Error: {}".format(response.json()["error"]), fg="red", bold=True)) | ||
echo(style("\nError: {}".format(response.json()["error"]), fg="red", bold=True)) | ||
echo(style("\nUse `evalai challenges` to fetch the active challenges.", fg="red", bold=True)) | ||
echo(style("\nUse `evalai challenge CHALLENGE phases` to fetch the active phases.\n", fg="red", bold=True)) |
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.
Any reason this line repeated so many times? Is there no better way to do this?
Asking so I can understand your thought process and recommend approaches. :)
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.
Now that I think about it,
echo(style("\nError: {}"
"Use `evalai challenges` to fetch the active challenges."
"Use `evalai challenge CHALLENGE phases` to fetch the active"
"phases.\n".format(response.json()["error"]),
fg="red", bold=True))
Looks much better.
What do you think @varunagrawal @RishabhJain2018 ?
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.
Yup, this looks nice since it captures all the instructions together.
833ef8d
to
14cb410
Compare
@RishabhJain2018 Conflicts fixed! |
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.
LGTM :)
@isht3 please resolve conflicts here! |
14cb410
to
dc8dbc3
Compare
@RishabhJain2018 Done! |
* Fix error responses in challenges * Fix error responses in teams * Fix conflicts
No description provided.