zuul passes a full stacktrace back to client before it calls errorFilter, is there a wat to stop this behaviour - netflix-zuul

When zuul throws an uncaught exception, I want to log the stack trace and pass a simple message back to the client.
Reading the docs, this is carried out with error filter. I log the error and create an error response. But when running the code, Its passes the stack trace back to the client before it gets to my errorfilter functionality.
Is there something I need to set, so when an unhandled exception is the error filter does all the work.
There is a way around this, capture the exception in the calling filter. but then that seems to defeat the purpose of the ErrorFilter.

Found the fix.
in the properties or yml need to set the following zuul.SendErrorFilter.error.disable=true

Related

JConsole always returning successful even though exceptions occur

I am trying to get a JMX MBean operation to return something other than "Method successfully invoked", from JConsole. When an exception occurs in the invoked method, I would like to see "Method failed" from JConsole, rather than "Method successfully invoked". Is there anything I can do in my MBean to make this happen?
JMXConsole, to my knowledge, will not report the method successfully invoked, unless it was. It sounds like the exception is being trapped in your target JMX invoked method, or somewhere in the path of execution of that method. Make sure you allow your exceptions to bubble up and eventually, the JMX layer will pick an exception type to wrap it in, usually javax.management.MBeanException if it was a generic exception.

Customize rails uncaught exception logging

So if there's an uncaught exception in my Rails app, it gets logged, with a stacktrace.
Great. But I'd actually like to turn off "INFO" level logging, and only log WARN/ERROR/FATAL.
Which means, for the uncaught excpetions, I REALLY want it to log a lot more about the current request, not just an exception name and stack trace. I want the request params, the request URI, I even want the request client IP and user-agent.
I am having trouble finding what part of Rails to customize to get this. Whether by config alone or by over-riding a method, or even by monkey patching -- I can't quite figure out where this actually happens.
Is that because it's off in middleware? Bah! Either way... any hints as to the easiest way to actually do this?
(It is surprising that Rails does not make this easy, no? It seems like not that unusual of a thing? Is it because everyone that cares is using some third party platform for catching these things instead of log files? I'm not, heh.)
You can add additional exception handling by catching all exceptions with rescue_from.
For example, you can add this to your application_controller.rb:
rescue_from Exception, :with => :internal_error
def internal_error(e)
logger.error request.fullpath
raise e
end
By re-raising the original exception you ensure rails gets to see it also.
See https://github.com/rails/rails/issues/9343, this is not supported yet. It seems that the DebugExceptions middleware is logging this. The only solution I see atm is to swap out this middleware using config.middleware.swap and replacing it with a custom version.

How to handle an ASP.NET MVC ActionResult Exception?

I have a custom ActionResult which is more deeply encountering System.Web.HttpException when the remote host closes the connection. I've already overridden the Controller's OnException method but it's not getting caught there. The ASP.NET MVC pipeline is already done executing my Controller's Action and is now executing the returned ActionResult when it encounters this exception.
Presently, it's bubbling up and being cluttering my log as an ERROR. I'd rather not filter these out at logging time, because I don't consider a remote host aborting the download of the content to be an error.
I'd rather handle this error directly, but I can't tell where. Controller.OnException doesn't work, and so I doubt the IExceptionFilter would either. I could use Application_OnError but I fear that is too high up.
Isn't there a more MVC'ish way?
There are no other points to catch exceptions between Controller.OnException and Application_OnError. Be Brave and use Application_OnError
You can use HandleErrorAttribute to handle exceptions thrown in the controller action. As you pointed out in your question, I would suspect the error is beyond the scope of this attribute. That would leave only Application_OnError.
You could add a whitelist to your error handling code to ignore specific errors (specific type with specific code and maybe specific source/stacktrace).

TIdHTTPServer connection aborted

I have a http server application and I'm using TIdHTTPServer.
The problem I'm facing is that whenever a client is making a request(via a web browser) and the client refreshes/closes the page before the entire data is sent, the connection is aborted, now the server raises an exception, is there a way to catch and log this and also stop the exception message from showing?
Thank you for your time!
The exception that is thrown will only display a message box whilst running in the IDE.
The TIdHTTPServer will catch the exception itself and handle it. It doesn't cause a problem. If you feel the need, you can log these exceptions use the IdHTTPServer.OnException event, otherwise they're essentially discarded.

exceptions to trace.axd

I cant find useful description on tracing asp.net, so i am asking here - How do I send an exception from Controller (or View) to trace.axd but nothing else?
To show trace information only in trace.axd you should enable tracing in the web.config, set pageOutput = false, and not enable tracing on specific pages. To send exception info to the trace you will need to use Trace.Write when you catch the exceptions.

Resources