planetscale/cli

[Feature Request] Improved Error Message When Attempting to Dump Sleeping Databases

orware opened this issue · 0 comments

We had a user encounter this earlier today and it seems to make sense that we may want to provide an improved error message in this situation to make it clearer to users that may need to switch organizations or provide the --org flag.

This cropped up specifically because the user had two organizations with two databases and branch names that were the same, with the earlier database in the default organization being asleep, and the error message the user encountered didn't make it apparent that the issue was organization related.

Scenario:

Default Organization: org1
Database: example-database
Branch: main
State: sleeping

Secondary Organization: org2
Database: example-database
Branch: main
State: ready

CLI Output Examples:

Using examples from one of our discussion responses the user put together a command like the following one:

> pscale database dump example-database main
Error: database branch is not ready yet, please try again in a few minutes

But the error message was odd to the user, and proved to be a blocking issue for several hours until the --org flag was discovered and they were able to figure out what they needed to do.

Since the database with the same name is present in the sleeping state within org1 the error message above is returned, but doesn't make it clear that the database is in the sleeping state, nor does it make it apparent which organization the command is running against.

If the database or branch names had been slightly different in some way however, as shown in the next command example, a more detailed error message ends up being provided to users, which can be a bit more helpful since it at least mentions the active organization in the message, although we may still want to have a specific message that is displayed when commands are run against sleeping databases:

> pscale database dump example-database made-up-branch-name-here
proxy error:  Not Found 
Error: branch made-up-branch-name-here does not exist in database example-database (organization: org1)

With a hint provided, users would be able to more quickly figure out that the organization is incorrect or that the database they are attempting the operation on is asleep and could adjust their command as needed.