Description
What should we add or change to make your life better?
Our setup
We use YARP as a gateway from our frontend client to the backend services, with communication via gRPC-web.
The suggestion
We encounter an issue when the client leaves a page while streaming data from a backend service through the YARP proxy. YARP throws a TaskCanceledException
in this scenario. No error is thrown or logged by the backend service. We expect this exception to be thrown, as it usually is when a task is canceled. However, it is currently not possible to catch and handle the exception with YARP. This is problematic for us because YARP logs the exception, which then gets caught by our analytics.
We have attempted to add middleware to address this issue, but we have been unable to stop the logging of the exception.
Changing the log level to not log errors is not a viable solution as we may miss other important errors.
We suggest one of the following solutions:
- Add a configuration flag to toggle the logging of
TaskCanceledException
since it is an expected exception. - Make it possible for the consumer of YARP to decide how to handle exceptions. This may be achievable if we can catch it in middleware.
Why is this important to you?
This is important to us as we don't want to log expected exceptions, which then gets reported by our analytics.