Skip to content

Commit 39da322

Browse files
committed
improve error handling during authentication failure
1 parent f698cf5 commit 39da322

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

check50/__main__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,16 @@ def main():
385385
try:
386386
commit_hash = lib50.push("check50", internal.slug, internal.CONFIG_LOADER, data={"check50": True}, auth_method=args.auth_method)[1]
387387
except lib50.ConnectionError:
388-
LOGGER.debug(traceback.format_exc()) # log the traceback
389-
raise _exceptions.Error(_(
390-
"check50 failed to authenticate your Github account. Try running check50 again with --https or --ssh, "
391-
"or try restarting your codespace. If the problem persists, please email us at [email protected]."
392-
))
388+
LOGGER.debug(traceback.format_exc()
389+
if not os.environ.get("CODESPACES"):
390+
raise _exceptions.Error(_(
391+
"check50 failed to authenticate your Github account. Please make sure you are connected to the internet and try again."
392+
))
393+
except Exception as e:
394+
LOGGER.debug(traceback.format_exc())
395+
raise _exceptions.Error(_("Sorry, something's wrong, please try again.\n"
396+
"If the problem persists, please visit our status page https://cs50.statuspage.io for more information.")) from e
397+
393398
with lib50.ProgressBar("Waiting for results") if "ansi" in args.output else nullcontext():
394399
tag_hash, results = await_results(commit_hash, internal.slug)
395400

0 commit comments

Comments
 (0)