Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve how errors are reported - better stack traces, exceptions #926

Open
glowforge-opensource opened this issue Mar 16, 2022 · 2 comments
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@glowforge-opensource
Copy link

Hi! This is definitely a feature request to get more visibility into what is going wrong when using the NodeJS Datastore client library.

Is your feature request related to a problem? Please describe.

At various points using the library (using async/await semantics), we've had issues where errors would be thrown. However, our application is fairly large so it can be hard to tell from the stack traces where things are going awry – or even what underlying Datastore API is being handled. For example, this is what one recent production Datastore exception gives us (@google-cloud/datastore version 6.6.2):

"Error: 14 UNAVAILABLE: read ECONNRESET
    at Object.callErrorFromStatus (/webpack:/path-to-our-app/node_modules/@grpc/grpc-js/build/src/call.js:31:1)
    at Object.onReceiveStatus (/webpack:/path-to-our-app/node_modules/@grpc/grpc-js/build/src/client.js:180:1)
    at Object.onReceiveStatus (/webpack:/path-to-our-app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:1)
    at Object.onReceiveStatus (/webpack:/path-to-our-app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:1)
    at /webpack:/path-to-our-app/node_modules/@grpc/grpc-js/build/src/call-stream.js:182:1
    at processTicksAndRejections (internal/process/task_queues.js:77:11)"

Additionally, almost all exceptions thrown by the Datastore client are type Error. There is no way to catch Datastore specific exceptions except to ensure any calls to it are very closely enclosed in try/catch and wrapped with another exception.

Describe the solution you'd like

Some or all of the following would be nice:

  • A base class for exceptions thrown by the Datastore client. One thing this would allow is including (since it's part of the API contract) whether or not the operation requested is retryable or not.
  • Stack traces that include some indicate of what Datastore API is being done. Is this happening during a query? A write operation? No way to tell.
  • If possible, stack traces that include what client library function is being called that resemble the function names our code is calling.
  • If possible, stack traces that include the calling context. I am not sure this is possible given NodeJS and how it does async/await.

Describe alternatives you've considered

We have mitigated the client throwing bare Error by wrapping all call sites with our own exception. Note the issue is not that the exception is being thrown, bu that it's fairly non-trivial to figure out what call point it's happening from and whether we need to change anything to address it.

Thank you!
Rachael Ludwick (from Glowforge)

@glowforge-opensource glowforge-opensource added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Mar 16, 2022
@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/nodejs-datastore API. label Mar 16, 2022
@kirillgroshkov
Copy link

That would be fantastic to address

@udnes99
Copy link

udnes99 commented Apr 11, 2024

Please prioritize getting this done. It is extremely frustrating and hard at times to debug when using Datastore extensively throughout our code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants