0

In the documentation it’s possible to define custom exceptions via ConnectionConfiguration as said here:

var settings = new ConnectionConfiguration()
    .SetConnectionStatusHandler(r=> {
        if (r.HttpStatusCode == 403)
           throw new MyApplicationNotLoggedInException();
        });

But ConnectionConfiguration is the way of setting up the low level API. Currently I use only Nest and my only option is to redefine ConnectionSettings where my only option is .ThrowExceptions(bool). Is there any option to use the low level api settings in Nest?

Michał J. Gąsior
  • 1,457
  • 3
  • 21
  • 39
  • You're looking at a very old version of the documentation. Take a look at: https://www.elastic.co/guide/en/elasticsearch/client/net-api/5.x/logging-with-on-request-completed.html `OnRequestCompleted()` is the method to use – Russ Cam Sep 01 '17 at 12:46
  • I can't catch the exception thrown inside the OnRequestCompleted. It doesn't help at all. – Michał J. Gąsior Sep 01 '17 at 13:13
  • Can you update the question to show how you are using the OnRequestCompleted to catch the exception that is thrown? There is an example of custom exceptions at the end of the his Getting Started Guide: https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/elasticsearch-net-getting-started.html – Paige Cook Sep 01 '17 at 16:34

0 Answers0