Package appstatus can attach/reterieve an application-specific response status to/from an error. It designed to prevent accidental exposure of internal statuses to RPC clients, for example Spanner's statuses.
TODO(nodir): move the package to luci/grpc if this approach proves useful.
Attach attaches an application-specific status to the error. The status will be shared with the RPC client as is. If err already has an application-specific status attached, panics.
Attachf is a shortcut for Attach(err, status.Newf(...))
BadRequest annotates err as a bad request. The error message is shared with the requester as is.
Errorf returns an error with an application-specific status. The message will be shared with the RPC client as is.
Get returns an application-specific Status attached to err using this package. If not explicitly set or if err is nil, then ok is false.