Structured data for error output

zcutlip
zcutlip
Community Member

Is there a way to get op to output errors in a structured format such as JSON?

For example, if I do op get item "Example Login" and there are two items with that name, I get:

[ERROR] 2020/12/03 17:06:41 More than one item matches "Example Login". Try again and specify the item by its UUID:
    * for the item "Example Login" in vault Test Data: nnotgv5xwrhjbdj6bt3rugrijy
    * for the item "Example Login" in vault Test Data: nok7367v4vbsfgg2fczwu4ei44

It'd be nice to get a JSON dictionary describing the problem and enumerating the two UUIDs.

For those of us using op from a script or within a framework, this would really help bubble the problem up to the user or to a higher level of the framework. Or even recover from the error gracefully, like running the query again for each of the UUIDs.

Apologies if this has been asked and answered already.

Cheers,
Zach


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • ag_yaron
    ag_yaron
    1Password Alumni

    Hey @zcutlip ,

    Unfortunately there's no way to output errors in specific formats yet. We still have a long way to go with errors improvements and readability, so keep your CLI up to date and stay tuned :)

  • zcutlip
    zcutlip
    Community Member

    Okay, no worries. I'll keep an eye out for things coming. Thanks!

  • ag_yaron
    ag_yaron
    1Password Alumni

    No problem :+1:

This discussion has been closed.