## Notation error message improvement This document lists the error message where we need to improve based on the [Notation CLI Error Handling and Message Guideline](https://github.com/notaryproject/notation/pull/834). ### case 1: Show trust policy but the trust policy doesn't exist. Now: ``` $ notation policy show Error: failed to load trust policy configuration, you may import one via `notation policy import <path-to-policy.json>`: open /tmp/ginkgo1532585024/notation/trustpolicy.json: no such file or directory ``` Suggested change: ``` $ notation policy show Error: failed to show trust policy configuration because the trust policy file does not exist. You may import one via `notation policy import <path-to-policy.json>` ``` ### case 2: Import a trust policy file but no file provided. Now: ``` $ notation policy import Error: accepts 1 arg(s), received 0 ``` Suggested change: ``` $ notation policy import Error: requires 1 argument but received 0. Usage: notation policy import <path-to-policy.json> Please specify a trust policy file as the argument. ``` ### case 3: Import an invalid trust policy file. Now: ``` $ notation policy import malformed_registry_scope_trustpolicy.json Error: failed to validate trust policy: registry scope "localhost:5000\\test-repo" is not valid, make sure it is a fully qualified repository without the scheme, protocol or tag. For example domain.com/my/repository or a local scope like local/myOCILayout ``` Suggested change: ``` $ notation policy import malformed_registry_scope_trustpolicy.json Error: failed to validate trust policy: registry scope "localhost:5000\\test-repo" is not valid Make sure it is a fully qualified repository without the scheme, protocol or tag. For example, "domain.com/my/repository" or a local scope like "local/myOCILayout" ``` ### case 4: Import an existing trust policy file. Now: ``` $ notation policy import trustpolicy.json Existing trust policy configuration found, do you want to overwrite it? [y/N] ``` Suggested change: ``` $ notation policy import trustpolicy.json The trust policy configuration already exists, do you want to overwrite it? [y/N] ``` ### case 5: Trust policy scope is missing when verifying images in OCI layout: Now: ``` $ notation verify <registry>/<repository>:<tag> --oci-layout Warning: This feature is experimental and may not be fully tested or completed and may be deprecated. Report any issues to "https://github/notaryproject/notation" Error: if any flags in the group [oci-layout scope] are set they must all be set; missing [scope] ``` Suggested change: ``` $ notation verify <registry>/<repository>:<tag> --oci-layout Warning: This feature is experimental and may not be fully tested or completed and may be deprecated. Report any issues to "https://github/notaryproject/notation" Error: missing trust policy scope Usage: notation verify --oci-layout <registry>/<repository>:<tag> --scope <trust_policy_scope> Please specify a trust policy scope with the flag "--scope" ```