Skip to content

ref: Fix `Internal` errors in `FindTag()` when tag doesn't exist

Patrick Steinhardt requested to merge pks-find-tag-structured-errors into master

The FindTag() RPC is currently returning an Internal error in case the requested tag doesn't exist. This is bad due to two reasons:

- It impacts our SLOs as `Internal` errors are typically unexpected
  error cases that shouldn't happen during normal operations. A tag
  that doesn't exist is an entirely valid outcome though and should
  thus have a proper error code.

- The Rails callsite needs to always handle `Internal` errors as if
  the tag doesn't exist, even though the RPC call could have due to
  an entirely different reason.

Fix both issues by returning a structured FindTagError error which allows us to indicate that the tag indeed wasn't found. Like this, callers can special-case this scenario and don't have to parse error messages and we can start to return a proper gRPC error code, which is NotFound in our case here.

Merge request reports