exception-handling

When does CallContext LogicalSetData get cleared? Issues with WebApi global ExceptionHandler

我的未来我决定 提交于 2019-12-24 03:18:36
问题 We are implementing a global exception handler for our WebAPI (like in this link) http://www.asp.net/web-api/overview/web-api-routing-and-actions/web-api-global-error-handling We are also using log4net's LogicalThreadContext to pass around context information (like a call context id or a correlation id). For those of you not familiar, this uses CallContext.LogicalSetData and LogicalGetData. My problem is that I can't seem to access the data once I get into our custom ExceptionLogger and

Custom error messages in Python

左心房为你撑大大i 提交于 2019-12-24 03:15:17
问题 So I'm practicing some unit test and I have a question about error messages. I'm trying to create a custom error message that will display when the test fails. Here is a basic Hello World program. The test runs fine and everything, but here is the error message I get. F ====================================================================== FAIL: test_StringContains (__main__.TestSuite) ---------------------------------------------------------------------- Traceback (most recent call last):

Symfony 2.3 - Custom Fatal Errors

流过昼夜 提交于 2019-12-24 03:12:29
问题 I've got a problem with Symfony 2.3, I can't get it to work to get a custom function that handles the fatal errors. The Symfony exceptions work fine, like a 404 etc. but a fatal error not. This is what I've got after searching the internet, I've a created a parent controller in the TestBundle. The other default controller extends the TestingSomeThingController. Se the files below for the code. But when I deleted the ; at the end of the line in DefaultController it's shows the standard fatal

What to do about uncaught run-time exceptions in Java FX2? [duplicate]

故事扮演 提交于 2019-12-24 03:09:38
问题 This question already has answers here : JavaFX 2 - Catching all runtime exceptions (3 answers) Closed 6 years ago . Update: As indicated in the comments below, JavaFx8 will handle uncaught run-time exceptions - but what to do about them now? Presently they just go to the Java console so in this case, clicking the button just makes it fail silently. It would be nice if a popup dialog would at least alert the user that something went wrong. Any ideas how? Earlier question: In my JavaFX2

Using ThreadExceptionEventHandler: determine which thread caused the exception

情到浓时终转凉″ 提交于 2019-12-24 03:07:24
问题 Using the Application.ThreadExceptionEventHandler, is it possible to determine which thread caused the exception (the thread id)? The same question applies to using the AppDomain.UnhandledExceptionEventHandler to catch non-UI thread exceptions. If the answer is no, is there any other way to determine which thread raised the unhandled exception in such cases? 回答1: I haven't checked, but I'd expect the handler to be executed in the thread which threw the exception - in which case Thread

Why does the program not terminate when a method that throws RuntimeException is called without handling the exception in Java?

会有一股神秘感。 提交于 2019-12-24 03:00:34
问题 Class 1: package hf; public class apples { public static void main(String[] args) { Good good = new Good(); good.method(); } } Class 2: package hf; public class Goodie extends NullPointerException { } Class 3: package hf; public class Good { public void method() throws Goodie { System.out.println("Goodmethod"); throw new Goodie(); } } I have not used any try/catch block to catch the NullPointerException(which extends RunTimeException) that is thrown when I call good.method() in class 1. When

Capture response when a service returns a 500 error using WCF

落花浮王杯 提交于 2019-12-24 02:33:28
问题 I'm getting data from a 3rd party web service using REST (using WebHttpBinding and WebHttpBehavior ). When I pass an invalid parameter in the querystring, the service responds with a 500 status and describes the problem. The response looks something like this: HTTP/1.1 500 Internal Server Error Date: Tue, 14 Jun 2011 16:12:48 GMT ... more headers <Error>Invalid integer value for ID</Error> I would really like to be able to capture that error message. My WCF client looks like this: public

Capture response when a service returns a 500 error using WCF

我怕爱的太早我们不能终老 提交于 2019-12-24 02:33:07
问题 I'm getting data from a 3rd party web service using REST (using WebHttpBinding and WebHttpBehavior ). When I pass an invalid parameter in the querystring, the service responds with a 500 status and describes the problem. The response looks something like this: HTTP/1.1 500 Internal Server Error Date: Tue, 14 Jun 2011 16:12:48 GMT ... more headers <Error>Invalid integer value for ID</Error> I would really like to be able to capture that error message. My WCF client looks like this: public

Need to determine if ELMAH is logging an unhandled exception or one raised by ErrorSignal.Raise()

喜夏-厌秋 提交于 2019-12-24 02:26:12
问题 I am using the Elmah Logged event in my Global.asax file to transfer users to a feedback form when an unhandled exception occurs. Sometimes I log other handled exceptions. For example: ErrorSignal.FromCurrentContext().Raise(new System.ApplicationException("Program code not found: " + Student.MostRecentApplication.ProgramCode)); // more code that should execute after logging this exception The problem I am having is that the Logged event gets fired for both unhandled and these handled, raised

Need to determine if ELMAH is logging an unhandled exception or one raised by ErrorSignal.Raise()

爱⌒轻易说出口 提交于 2019-12-24 02:26:07
问题 I am using the Elmah Logged event in my Global.asax file to transfer users to a feedback form when an unhandled exception occurs. Sometimes I log other handled exceptions. For example: ErrorSignal.FromCurrentContext().Raise(new System.ApplicationException("Program code not found: " + Student.MostRecentApplication.ProgramCode)); // more code that should execute after logging this exception The problem I am having is that the Logged event gets fired for both unhandled and these handled, raised