Open MartinM85 opened 7 months ago
That's indeed something we've been looking into, to throw a clear message when you lack the permissions. However if I remember it correctly that wasn't so easy. Anyone knows on which issue we had this discussion @pnp/cli-for-microsoft-365-maintainers ?
Do you mean this one @milanholemans https://github.com/pnp/cli-microsoft365/issues/5642?
The problem here is that the message
property is empty so we default to trying to print the error object, which in this case is useless. We could extend the error printing logic so that when can't show a human-friendly message, we try to deduct what's wrong based on the status code and the API used in the request.
Exactly, even in this case we may see that the error is
error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2024-02-08T07:38:08",
"request-id": "79fa98d1-e457-42ff-bf4d-b949a1ce2f16",
"client-request-id": "79fa98d1-e457-42ff-bf4d-b949a1ce2f16"
}
So actually the API that we use under the hood is not really helping us to say with 100% confidence to the user what happened and what is the reason. We may only provide some guesses. It would be best if the MS Graph API could provide the error message. 🙂
It would be best if the MS Graph API could provide the error message. 🙂
Ideally, yes, and we should definitely bring it up with the Graph team. Until then, let's see if we can add a reasonable workaround to the CLI to make it a bit more user-friendly.
When running the command
external connection get --id <connection_name>
the output wasIt was not clear what's the issue until I run
external connection get --id <connection_name> --debug
Maybe it's general issue for all commands without appropriate permission.