zowe-cli icon indicating copy to clipboard operation
zowe-cli copied to clipboard

Improve user friendlyness error for listing members in a data set

Open Joe-Winchester opened this issue 4 years ago • 9 comments

Problem

When using zowe files list all-members <PDS-NAME> if the PDS is invalid the error message includes information about 404 codes and rc: 8, which can make it look as though there is a runtime CLI problem rather than just a user error.

Joes-MBP-3:~ Joe$ zowe files list all-members "WINCJ.JCL"
Command Error:
z/OSMF REST API Error:
Rest API failure with HTTP(S) status 404
category: 4
rc:       8
reason:   0
message:  LMINIT error
details: 
  - ISRZ002 Data set not cataloged - 'WINCJ.JCL' was not found in catalog.


Error Details:
HTTP(S) error status "404" received.
Review request details (resource, base path, credentials, payload) and ensure correctness.

Host:      winmvs3b.hursley.ibm.com
Port:      32070
Base Path: 
Resource:  /zosmf/restfiles/ds/WINCJ.JCL/member
Request:   GET
Headers:   [{"X-IBM-Max-Items":"0"},{"X-CSRF-ZOSMF-HEADER":true}]
Payload:   undefined
``
 
**Solution**

echo a more user friendly error, such as `Partitioned Data Set {n)` not found.

There are other examples of where a CLI command with an invalid path or input PDS emits the raw https://. response.  If one exists that parses the response into a more friendly error, this could perhaps become a good example for others to base and form some good first issue cli items.  It's possible there is already such an example of how to do this so apologies if so.

Joe-Winchester avatar Feb 01 '21 17:02 Joe-Winchester

@dkelosky do you think we should open a z/OSMF RFE to improve this error message?

MikeBauerCA avatar Feb 01 '21 18:02 MikeBauerCA

Potentially, as I read this though, I think we have a good message already. The problem is that it’s buried by a bunch of other messages.

Are you interested in only seeing the “details” @Joe-Winchester ?

dkelosky avatar Feb 01 '21 21:02 dkelosky

I agree there is a good message there, but it's wrapped in a quite a bit of chaff. By comparison with other CLIs when a mistake is made there is usually a one-liner, e.g

>chmod asd
chmod: asd: No such file or directory
>

In the example of `zowe files list all-members "WINCJ.JCL" the current echo to the user has "Command Error" and "Error Details" that get colored red in my mac terminal and look like a low level crash. Including the "HTTP(S) error status "404" received" also feels like low level debug info that a user can't really do a lot about.

What if you just echo'd the details:

>zowe files list all-members "WINCJ.JCL"
-ISRZ002 Data set not cataloged - 'WINCJ.JCL' was not found in catalog
>

The message ISRZ002 is a z/OS error so it can be googled.

Likewise `zowe files list uss /u/bob' emits

Command Error:
z/OSMF REST API Error:
Rest API failure with HTTP(S) status 404
category: 1
rc:       4
reason:   8
message:  Path name not found
details: 
  - EDC5129I No such file or directory. (errno2=0x053B006C)


Error Details:
HTTP(S) error status "404" received.
Review request details (resource, base path, credentials, payload) and ensure correctness.

Host:      winmvs3b.hursley.ibm.com
Port:      32070
Base Path: 
Resource:  /zosmf/restfiles/fs?path=%2Fu%2Fbob
Request:   GET
Headers:   [{"X-IBM-Max-Items":"0"},{"X-CSRF-ZOSMF-HEADER":true}]
Payload:   undefined

This could be simplified to

>zowe files list uss /u/bob
- EDC5129I No such file or directory. (errno2=0x053B006C)
>

and so forth.

Maybe have some kind of "messageResponse=DEBUG/INFO" value that can be set as a Zowe parm in case someone does want to drill down into low level REST debugging ?

Joe-Winchester avatar Feb 02 '21 11:02 Joe-Winchester

I think it's a neat idea. If we print out a short version of errors, we can also echo how to enable verbose messaging.

All we need now are a bunch of 👍

dkelosky avatar Feb 02 '21 13:02 dkelosky

For this particular error, I agree. I would like to see a sampling of other common errors, with and without the details. The "Review request details" section has helped in various situations, especially with connection details (e.g. mistyped host/port).

MikeBauerCA avatar Feb 02 '21 14:02 MikeBauerCA

@dkelosky @Joe-Winchester @MikeBauerCA I made the above PR 1075 for the command. Please confirm if you think this is a good way to implement user friendly error messaging. Then, I can do this for other commands that we need to discuss and do it for.

Basically, I've edited catching an error in packages/zosfiles/src/methods/list/List.ts to throw only the short error message unless an option --debug-response or --dr is specified with the command. If the option is included, then it shows all the REST API level info.

namanpatel1112 avatar Jul 26 '21 13:07 namanpatel1112

Thanks for the tag; I'll add a comment to the PR.

dkelosky avatar Jul 26 '21 20:07 dkelosky

Thank you for raising this issue. The community has 90 days to upvote 👍 the issue. If it receives 5 upvotes, we will move it to our backlog. If not, we will close it.

github-actions[bot] avatar Sep 15 '22 17:09 github-actions[bot]

After some discussion, here are a list of things we could do to accomplish this.

  1. Add color to the labels within the error message (e.g. categories, rc, reason, message, details)
  2. Create a ZOWE_CLI_SHORT_ERRORS environment variable
    • Only show details when enabled
    • Full error should still be in the logs
  3. Ask z/OSMF for a short user-friendly message
  4. Ask z/OSMF for a "catalog" endpoint (similar to qwikref)

Only implementing the number 1 item makes this a good first issue

zFernand0 avatar Oct 12 '22 13:10 zFernand0

Thank you for raising this enhancement request. The community has 90 days to vote on it. If the enhancement receives at least 5 upvotes, it is added to our development backlog. If it receives fewer votes, the issue is closed.

github-actions[bot] avatar Mar 08 '23 19:03 github-actions[bot]