Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Adding exception text to exit message for invalid clientsecrets #530

Merged
merged 1 commit into from
Jun 29, 2016

Conversation

pferate
Copy link
Contributor

@pferate pferate commented Jun 27, 2016

This is to address a problem found in googleapis/google-api-python-client#228.

This will give users the text from the InvalidClientSecretsError exception, in addition to the generic message that it currently does. The format of the message can be modified, if needed.

@theacodes theacodes self-assigned this Jun 27, 2016
if message:
if str(e):
message = 'Error: %s\n================\n%s' % (str(e), message)
sys.exit(message)

This comment was marked as spam.

@theacodes
Copy link
Contributor

Thanks for this contribution. Do you mind adding or augmenting the existing test for this?

@@ -2210,8 +2210,10 @@ def flow_from_clientsecrets(filename, scope, redirect_uri=None,
client_info['client_id'], client_info['client_secret'],
scope, **constructor_kwargs)

except clientsecrets.InvalidClientSecretsError:
except clientsecrets.InvalidClientSecretsError as e:
if message:

This comment was marked as spam.

This comment was marked as spam.

@pferate pferate force-pushed the clientsecret_message branch 2 times, most recently from 5692970 to 85fd0b3 Compare June 28, 2016 17:39
@pferate
Copy link
Contributor Author

pferate commented Jun 28, 2016

@jonparrott @nathanielmanistaatgoogle, I updated this PR again and added a test for this (slightly modified a previous test). Travis passed on my branch, but still waiting to launch for this PR.

I had to use positional argument specifiers in the .format() string to have it work with 2.6.

@theacodes
Copy link
Contributor

Great, this looks good to me. @nathanielmanistaatgoogle to do the final review.

@nathanielmanistaatgoogle
Copy link
Contributor

Change content looks good; please amend your commit log message to meet the guidelines.

@pferate pferate force-pushed the clientsecret_message branch from 85fd0b3 to 432035e Compare June 28, 2016 22:17
If `clientsecrets.InvalidClientSecretsError` is raised with additional
text and a predefined failure message is given, include exception text
in the exit message.
@pferate pferate force-pushed the clientsecret_message branch from 432035e to 4fe7d69 Compare June 28, 2016 22:21
@pferate
Copy link
Contributor Author

pferate commented Jun 28, 2016

Commit message updated.

@theacodes
Copy link
Contributor

Waiting for travis.

@theacodes theacodes merged commit a4e3431 into googleapis:master Jun 29, 2016
@theacodes
Copy link
Contributor

Thanks for your contributions, @pferate!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants