Stop printing org.mule.exception.CatchMessagingExceptionStrategy errors - mule

In my mule flow, I get org.mule.exception.CatchMessagingExceptionStrategy error printed to log when the message is rejected. I have an exception strategy that can handle the exception, but the error and exception stack trace is printed to the log which will make the log unreadable by time. How can it be stopped? Actually, it is funny to have an error message when something is rejected by a filter, it should just silently work on accepted items.
ERROR 2017-07-10 11:33:18,723 [[...-flow].connector.sftp.mule.default.receiver.01] org.mule.exception.CatchMessagingExceptionStrategy

if you are using a newer mule version the catch exception strategy should allow you to set logException="true" on the catch-exception-strategy element
i.e. <catch-exception-strategy logException="true">
or else you can uncheck the "Log Exceptions" button from within studio's GUI.

Related

Selenium: Does it useful to catch NoSuchElementException appears for a clickable element?

Why do we catch NoSuchElementException? It makes sense to catch the exception when we only verify the presence of an element in a particular page and not performing any actions on it. We can catch this exception and log a custom message like "Element not found"
When we are about to click an element and if it is not found in the page, selenium throws NoSuchElementException. What is the use of catching this exception instead of letting it to halt the test and failing the testcase?
Note: My subsequent steps depends on this clicking step.
One reason to catch the exception is to provide more relevant test failure output. For example, if a div element isn't found in a page of 20-30 divs, cause the selector doesn't match that specific div, you could let the exception remain uncaught with a generic error message or you could catch it and throw a different exception with error message "navbar is missing".
If it is clear from the generic error message what is wrong, or you have a test failure message that explains it, there is no reason to catch it.
A different reason to catch this exception is that it's part of skip code (skip this test if/unless). So you look for an element and if it's present you proceed with the test, if it's not - you skip it.
There may be other reasons, but these are two common ones.
There are two types of Exceptions:
1.Checked Exceptions
2.Unchecked Exceptions
Checked Exceptions are checked at compile time only, these should be handled by the programmer. Compiler will check at compile time whether these exceptions are handled or not if not compile time error occurs. Some of the checked exceptions are IOException, FileNotFoundExpection,etc.
Unchecked Exceptions:
Unchecked exceptions are not checked by compiler at the time of compilation. the exceptions which are extended by RuntimeException class are all unchecked exceptions. Some of the unchecked exceptions are AritmeticException, NullPointerException etc. In selenium we see unchecked exceptions such as NoSuchElementException, StaleElementReferenceException , NoSuchWindowException, TimeoutException etc.
In short, Checked exceptions must be caught. RuntimeException, also called unchecked exceptions, should not be caught
More info can be found on
http://toolsqa.com/selenium-webdriver/exception-handling-selenium-webdriver/
http://www.seleniumeasy.com/java-tutorials/exception-handling-in-selenium-webdriver-using-java-examples

wcf fault exception not throwing/being caught properly

This is the exception I get:
An exception of type 'System.ServiceModel.FaultException`1' occurred in TestService.exe but was not handled in user code
I try to run my client and the debugger gets caught when I try to do the following
catch (Exception ex)
throw new FaultException<GeneralCalculatorFault>(fault, ex.ToString());
What could be the problem. Let me know if I need to provide more info.
I answered the question myself. It was giving me trouble because of a setting in Visual Studio 2012.
Whenever the exception was thrown if I pressed "Continue", it handled everything just fine on the client side just like it should. There is a checkbox on the server side that allows me to ignore exceptions of particular types, so I checked it and now the server side no longer complains that the exception is not being handled.
Maybe this will help some other newbie like me. :)

WCF RIA Services & Silverlight: Custom Exception Messages + Load operation failed for x

So on the server I send back custom exception messages, meant to be displayed to the user (think "Bad Username/Password", "Account has been locked out" etc.)
However, when I view the Exception message in silverlight it is prefixed with "Load operation failed for x." I was thinking that Exception.InnerException would be a good place to put the original Exception, but I guess the RIA team didn't agree.
Is there a way to get my original exception message? Sure, I could write a quick regex to parse it out, but that feels dirty... Is that my only option?
I read about a solution that may work for you. I have yet to implement it myself though.
http://mark.mymonster.nl/2011/02/10/make-use-of-wcf-faultcontracts-in-silverlight-clients/

How to debug exception on other thread?

I have a lot of shortlived threads that updates my program, by events fired from a socket connection. My problem is I don't know how to debug this, like how to get the proper information on where in the code the exceptions occur. Because I get for example an exception like below, and this will just be the print in the Immidiate Window. There is no pop-up window, and it does not highlight any line in the code or show even what method it was in.
What am I missing? What I can do to see these things? And what improvements does VS2010 give on this situation, if any?
A first chance exception of type 'System.InvalidOperationException' occurred in System.Core.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in Krs.Ats.IBNet.dll
Go to "Debug -> Exceptions...", locate the "Common Language Runtime Exceptions" and check the "Thrown" mark. Now start debugging your application. Once any of CLR exception occurs the execution will stop on that line.

A First Chance Exception

've been running through the MSDN help documents to get a hang of Visual Basic. After trying out the example using timers --one drags a label and timer component into the designer and adds the following to the components subroutine
Label1.Text = My.Computer.Clock.LocalTime.ToLongTimeString
The output for the immediate window during debug is the following
A first chance exception of type
'System.InvalidCastException' occured
in Microsoft.VisualBasic.dll
A first
chance exception of type
'System.InvalidCastException' occured
in Microsoft.VisualBasic.dll
The same error occurs on a previous MSDN example using a context menu component. Should I Try...Catch...Finally this error and try to move on? Or, am I dealing with something much more serious?
When you see something about a first chance exception, it only means that an exception was caught within the code you called but does not necessarily mean that the code failed. If the code runs without causing your program to crash and returns a valid value, then do not have a problem. You will also see output in the debug window about first chance exceptions when you implement your own try/catch blocks.
In the Debug menu -> Exceptions, you can enable the debugger to stop when an Exception is first thrown, even if it would be caught later; if you want to find out what's happening, this is the easiest way to do it
In the first chance exception examine the details of the exception. You should see a stack frame/trace property. In there you should see what line the error occurs on. This should help you.
In the IDE try going to Tools > Options > Projects and Solutions > VB Defaults and setting Option Strict to 'On' - this may help catch casting problems when you compile your project rather than when you run it.
A 'first chance execption' does not necessarily mean you have a problem in your code. It could mean the IDE or the compiler or any other involved component encountered and handled an error and in the process the debugger is notified and the exception is being reported to the immediate window. This is an excellent post on the topic:
http://blogs.msdn.com/davidklinems/archive/2005/07/12/438061.aspx
A quick and easy solution for debug and diag of First Chance Exception is :
AppDomain.CurrentDomain.FirstChanceException += CurrentDomainOnFirstChanceException;
and then
private void CurrentDomainOnFirstChanceException(object sender, FirstChanceExceptionEventArgs firstChanceExceptionEventArgs)
{
if (firstChanceExceptionEventArgs.Exception is NullReferenceException)
{
// do your handling and debugging :)
}
}
Multiple First Chance Exception during the runtime can cripple the performance of your application because exception handling is expensive. Especially in web apps. You can add this handler and look at specific first chance exceptions and try to avoid/correct them.