balena-io / balena-cli

The official balena CLI tool.
Apache License 2.0
452 stars 138 forks source link

Error handling when not logged in (openBalena) #2090

Open maggie44 opened 3 years ago

maggie44 commented 3 years ago

Using Open Balena 3.1.0 and CLI 12.26.2.

When executing a request from the CLI while it is not logged in I get the following response:

BalenaRequestError: Request error: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /whoami</pre>
</body>
</html>

Additional information may be available with the `--debug` flag.
For help, visit our support forums: https://forums.balena.io
For bug reports or feature requests, see: https://github.com/balena-io/balena-cli/issues/

Logging in resolves the issue and the command executes. I'm not sure if it has always been like this. Perhaps a clearer error message when the issue occurs would be helpful.

beasteers commented 3 years ago

Yeah I agree that a 403 unauthorized type error message would make this clearer. It takes you a minute the first time to realize that the problem is that you're not logged in and not that the API is down or something.