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

ServerInterceptor does not catch runtime errors #15

Open
artofhuman opened this issue Mar 21, 2024 · 0 comments
Open

ServerInterceptor does not catch runtime errors #15

artofhuman opened this issue Mar 21, 2024 · 0 comments

Comments

@artofhuman
Copy link

For example, if I will receive error in my controller

def get_users
   raise "something wrong"
end

gruf-sentry does not send that error to sentry. I believe that because here https://github.com/bigcommerce/gruf-sentry/blob/main/lib/gruf/sentry/server_interceptor.rb#L35 e is RuntimeError and not isGRPC::Internalclass, since interceptors are called before construct GRPC::Internal error here https://github.com/bigcommerce/gruf/blob/main/lib/gruf/controllers/base.rb#L93-L95

and

error?(e)  => false

as error not configured.

We can add all our errors togrpc_error_classes, as example:

grpc_error_classes: Gruf::Sentry.grpc_error_classes << "RuntimeError"

And it should work, but it looks like a hack, and seconds we need to add all error classes, such as error? compares strings, it's impossible in large applications.
So, is there any workaround how to catch all application errors and send them to sentry using gruf-sentry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant