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

fix #313: fix handle error key not found problem in logging errors due to jwt api #320

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions evalai/utils/challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def display_challenge_details(challenge):
validate_token(response.json())
echo(
style(
"\nError: {}".format(response.json()["error"]),
"\nError: {}".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -390,7 +390,7 @@ def display_challenge_phase_list(challenge_id):
validate_token(response.json())
echo(
style(
"\nError: {}".format(response.json()["error"]),
"\nError: {}".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -509,7 +509,7 @@ def display_challenge_phase_detail(challenge_id, phase_id, is_json):
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()["error"]),
"active phases.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -577,7 +577,7 @@ def display_challenge_phase_split_list(challenge_id):
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()["error"]),
"active phases.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -640,7 +640,7 @@ def display_leaderboard(challenge_id, phase_split_id):
validate_token(response.json())
echo(
style(
"Error: {}".format(response.json()["error"]),
"Error: {}".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down
4 changes: 2 additions & 2 deletions evalai/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ def upload_file_using_presigned_url(challenge_phase_pk, file, file_type, submiss
if response.status_code in EVALAI_ERROR_CODES:
validate_token(response.json())
if file_type == "submission":
error_message = "\nThere was an error while making the submission: {}\n".format(response.json()["error"])
error_message = "\nThere was an error while making the submission: {}\n".format(response.json().get("error", response.json().get("detail")))
elif file_type == "annotation":
error_message = "\nThere was an error while uploading the annotation file: {}".format(response.json()["error"])
error_message = "\nThere was an error while uploading the annotation file: {}".format(response.json().get("error", response.json().get("detail")))
echo(
style(
error_message,
Expand Down
4 changes: 2 additions & 2 deletions evalai/utils/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def make_request(path, method, files=None, data=None):
validate_token(response.json())
echo(
style(
"\nError: {}\n".format(response.json().get("error")),
"\nError: {}\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -64,7 +64,7 @@ def make_request(path, method, files=None, data=None):
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()["error"]),
"active phases.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down
8 changes: 4 additions & 4 deletions evalai/utils/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_submission_meta_attributes(challenge_id, phase_id):
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()),
"active phases.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -99,7 +99,7 @@ def make_submission(
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()["error"]),
"active phases.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -219,7 +219,7 @@ def display_my_submission_details(
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai challenge CHALLENGE phases` to fetch the "
"active phases.\n".format(response.json()["error"]),
"active phases.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -290,7 +290,7 @@ def submission_details_request(submission_id):
"\nError: {}\n"
"\nUse `evalai challenge CHALLENGE phase PHASE submissions` "
"to view your submission.\n".format(
response.json()["error"]
response.json().get("error", response.json().get("detail"))
),
fg="red",
bold=True,
Expand Down
6 changes: 3 additions & 3 deletions evalai/utils/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def display_teams(is_host):
validate_token(response.json())
echo(
style(
"Error: {}".format(response.json()["error"]),
"Error: {}".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -130,7 +130,7 @@ def create_team(team_name, team_url, is_host):
else:
echo(
style(
"Error: {}".format(response.json()["error"]),
"Error: {}".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down Expand Up @@ -194,7 +194,7 @@ def participate_in_a_challenge(challenge_id, participant_team_id):
"\nError: {}\n"
"\nUse `evalai challenges` to fetch the active challenges.\n"
"\nUse `evalai teams` to fetch your participant "
"teams.\n".format(response.json()["error"]),
"teams.\n".format(response.json().get("error", response.json().get("detail"))),
fg="red",
bold=True,
)
Expand Down