datawire / datawire-cli

Datawire Cloud tools and utilities
1 stars 0 forks source link

specifying an invalid file with --state results in a "not logged in" error #33

Closed janicedatawire closed 8 years ago

janicedatawire commented 8 years ago

I created an org with a custom state file as follows:

$ dwc --state ~/.datawire/jmk5.txt create-org --test jmk5 jmk5 jmk5@example.org
Password for jmk5@example.org @ jmk5: 
Again: 
Now logged in as [26MD9XG84G]jmk5@example.org

If I specify a non-existent file location for --state in subsequent calls, I get a user not logged in error as follows:

$ dwc --state ~/.datawire/jmk5 status
Not presently logged in.

To log into an existing user, use dwc login.
To accept an invitation to join an organization, use dwc accept-invitation.
To create a new organization, use dwc create-org.

This may be as intended and after thinking about it for a second I can see why this error makes sense from a technical standpoint, but when possible I am in favor of error messages that tell users how to fix the problem and this one does not. It would be nice to indicate that the user supplied an invalid state file so they can try again with the correct value.

kflynn commented 8 years ago

This is indeed as designed – suppose you do the following:

dwc logout dwc status

There you haven't specified --state at all, but the situation is exactly the same: you're trying to run status with a nonexistent state file, and the most sane thing is to report that you're not logged in.

Basically, --state is an option whose presence implies that you have a clue. Differentiating between "you're not logged in" and "you have a clue but you happen to have typo'd the path to the state file while running a command that's meant to be reading but not creating the state file"... innh. :)

That being said, reopen if you feel really strongly about this one.