I was trying out the Couchbase’s official go lang lib. I have been using NodeJS SDK for a long time on couchbase.
I have just 1 question: How do I handle errors in gocb? In NodeJS counterpart there was an Error object associated so I could easily capture 404, Conflicts etc.
But in GoCB as per the documentation it returns the default
error type on return. On checking that documentation it’s just a string… Like for eg:
bucket.Get() returns “Key not found.” in error for a 404.
It may seem very dirty to do something like
if error == “Key not found.”
Is there any better way to detect errors?