Google Cloud Pub/Sub node library error parsing

127 views Asked by At

I'm trying to handle error responses returned from the Google Cloud Pub/Sub api using their node client library. From what I can see, if you use their REST API directly (ie. not through the client library) they return common HTTP error codes:

https://cloud.google.com/pubsub/docs/reference/error-codes

However, their client library returns RPC style errors that do not adhere to http status code conventions.

I have a worker that is processing these responses and is expecting responses to conform to standard http response conventions. Does anyone know if there is a way to intercept the actual HTTP response that the client is handling and extract a status code from it? Alternatively, is there documentation somewhere listing out the potential RPC errors the node client can return so I can set up a mapping from them to http codes?

Thanks!

1

There are 1 answers

0
ccnixon On BEST ANSWER