From cdc757ccb0125115382ee12a6a7c3a6ba3221783 Mon Sep 17 00:00:00 2001 From: iaacornus Date: Mon, 6 Jun 2022 20:34:44 +0800 Subject: [PATCH] include request and response exception to give better output for issues like #295 --- cli.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cli.py b/cli.py index 75d8349..2e873c7 100644 --- a/cli.py +++ b/cli.py @@ -1,6 +1,10 @@ import argparse -from prawcore.exceptions import OAuthException +from prawcore.exceptions import ( + OAuthException, + ResponseException, + RequestException +) from rich.console import Console from main import main @@ -79,11 +83,18 @@ def program_options(): print_substep("Error occured!", style="bold red") except OAuthException: console.print( - "There is something wrong with the .env file, kindly check:[/bold]\n" + "[bold red]There is something wrong with the .env file, kindly check:[/bold red]\n" + "1. ClientID\n" + "2. ClientSecret\n" + "3. If these variables are fine, kindly check other variables." ) + except ( + RequestException, + ResponseException, + ): + console.print( + "[bold red]Kindly check the kind of application created, it must be script.[/bold red]" + ) if __name__ == "__main__":