--format json could influence the error outputs

Options
flyinprogrammer
flyinprogrammer
Community Member

When you add "--format json" to a command, for example:

op item get sandwich --vault private --format json

If sandwich doesn't exist, you'll get:

[ERROR] 2024/04/24 20:11:53 "sandwich" isn't an item in the "private" vault. Specify the item with its UUID, name, or domain.

Perhaps it would be more useful for us mere mortals wrapping this CLI to get back something like:

{
    "err": "ErrMissingItem",
    "time": "2024/04/24 20:11:53 ",
    "msg": "\"sandwich\" isn't an item in the \"private\" vault. Specify the item with its UUID, name, or domain."
}

You know, something a machine can parse. Extra credit if we start to do some formal error types. That, or get us a golang sdk that can talk directly to the desktop app, or both! 😘


1Password Version: 8.10.30
Extension Version: 2.27.0
OS Version: macOS 14.4.1
Browser: Chrome

Comments

  • Dayton_ag
    Options

    Hey @flyinprogrammer, good idea! I can definitely see how JSON-formatted errors would be helpful, especially when invoking the CLI in a context where it's desired to handle the error. I can't make any promises for future changes, but I've shared this feedback with the team. 😃