scm-spain / karyon2-accesslog

0 stars 1 forks source link

Unhandled exception accesslog #19

Open padilo opened 8 years ago

padilo commented 8 years ago

Whenever an exception occurs the out interceptor is not invoked so the access log is not logged.

I don't know if there is another place we can do the logging part to log also the unhandled exceptions.

aramirez-es commented 8 years ago

Thanks for reporting the issue, Pablo. I noticed that some weeks ago but sincerely I don't know how to solve this problem right now.

As far as I understand, due to how Karyon works internally, if there is an unhandled exception (Karyon works with Rx and Rx handles all exceptions extending from RuntimeException) out interceptors are not executed at all.

But, honestly I've not looked deeply into this problem.

Any kind of help is welcomed :-)

padilo commented 8 years ago

I looked in karyon2 a bit more and I don't see a clear way to do this. It seems that in Karyon3 it's quite simple, as you have more directly access to rxnetty, but maybe I'm wrong :)

victuxbb commented 8 years ago

As we discussed in slack, with a few modifications in a VoidErrorHandler in routing system will be enough to get interceptors working.

Something similar to:

public class VoidErrorHandler implements ErrorHandler<ByteBuf> {
  @Override
  public Observable<?> handleError(HttpServerRequest<ByteBuf> request, Throwable throwable, StatusCodeSetter statusCode) {
    return Observable.empty();
  }
}