@@ -500,7 +500,11 @@ def setup_gmail(
500500 f"An error occurred within setup_gmail(): { err } " , "warn" , logger
501501 )
502502 except google .auth .exceptions .RefreshError as err :
503- raise johnnyfive .utils .J5Error from err
503+ raise johnnyfive .utils .J5Error (
504+ f"{ type (err ).__name__ } { err } \n "
505+ "https://stackoverflow.com/questions/10576386/invalid-grant-trying-to-get-oauth-token-from-google\n "
506+ "Try running j5_authenticate_gmail"
507+ ) from err
504508
505509 # If running in `interactive`, lauch browser to log in
506510 elif interactive :
@@ -512,15 +516,18 @@ def setup_gmail(
512516
513517 # Otherwise, raise an exception and specify to run interactively
514518 else :
515- johnnyfive . utils . proper_print (
519+ errmsg = (
516520 "No Gmail credentials found. You may need to run:\n "
517521 "\t `j5_install_conf`\n "
518522 "\t or to authenticate user, run (NOT in a container):\n "
519- "\t `j5_authenticate_gmail`" ,
523+ "\t `j5_authenticate_gmail`"
524+ )
525+ johnnyfive .utils .proper_print (
526+ errmsg ,
520527 "error" ,
521528 logger ,
522529 )
523- raise johnnyfive .utils .J5Error
530+ raise johnnyfive .utils .J5Error ( errmsg )
524531
525532 # Save the credentials for the next run
526533 with open (token_fn , "w" , encoding = "utf-8" ) as token :
0 commit comments