Skip to content

Bug report: printErrorsAsPlainText does not output json when parameters are not properly set #2429

@plamber

Description

@plamber

Description

The implementation of printErrorsAsPlainText simplifies the error handling in scripts by consolidating the standard and error output. This works fine if and returns a JSON error when a command fails calling an underlying Graph call.

On the other hand it will return a plain text when you are not fully specifying the parameters.

Steps to reproduce

  • set base output settings for scripting
m365 cli config set --key output --value json
m365 cli config set --key errorOutput --value stdout
m365 cli config set --key showHelpOnFailure --value false
m365 cli config set --key printErrorsAsPlainText --value false
  • call m365 aad o365group get --id "076f879d-3607-4860-91da-ca6345250fbc" with an invalid id -> this will return a json
  • call m365 aad o365group get --id without additional information -> this will return a text

Expected result

The setting is considered in both cases

Environment

  • Latest CLI version

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions