WSO2 ESB catch transport exceptions (MessageBuilder) - exception

When I read a message with a WSO2 ESB Proxy, I need to define a specific datatype and this is then applying a certain MessageBuilder (defined in the axis2.xml).
But when the MessageBuilder fails (i.e. I try to read a text file with the XMLBuilder) I get an exception in the console, but my "faultSequence" is not called. But I need to do a certain Error Handling in case of any read problem.
How can I catch Exceptions from the Transport Layer (MessageBuilder) in a Proxy?

As far as i understand , your requirement is to catch an Error in the Transport layer and handle that in the Application level (i.e : Mediation level). which means the layer above.
But i think it violates layered architecture of the messaging framework. You should catch the Exception at the Message Builder itself and throw an Axis Fault so that underlying synapse transport layer (in this case Axis2) will handle that error. (It will send a fault to the client.)
If we look at the TCP protocol stack that is the practice which is commonly used.
If you really want to filter this errors at mediation level. Catch that Error in the Message Builder and add a Message Context property or custom message and pass it as a successful message. And Do a filter in mediation level and handle.
But again that is ugly.
:)
--Charith

Have you defined onError attribute in your configuration?
<sequence name="main" onError="myFaultSequence">
You can have more information in this sample.

Related

BizTalk - Why does a suspended message appear in the console for a handled exception?

Here is an image of a common structure we have in a few of our BizTalk orchestrations:
So when we GET information from an API and the account doesn't exist, we terminate the orchestration. This works fine and I can see the orchestration doing this and terminating when it should, but what I don't understand is why do I see the suspended message from the GET in the console? Since the exception handling works, shouldn't this stop an error showing in the console?
As a way around this, I've considered using a pipeline component to check the response message, and if it contains what would be ignored, just return null in place of the message. Would this have the desired effect? I'm more interested as to why I see the suspended messages in the console.
Yes, this is a known issue with the WCF-WebHttp adapter, that has to do with the fact that it throws it back as a SOAP formatted error, but without setting the MessageType context property (see my blog post and look for Bug: BizTalk WCF-WebHttp adapter does not set the message type on error). So although the exception is thrown back at the Orchestration and can be handled there, the message is not as BizTalk does not know what type it is and it suspends.
A workaround we use is
To set Enable Routing for failed messages on the send port
To have a send port that subscribes to all the response messages from that send port using the BTS.SPName = xxxx filter, and send port sends it to a custom NULL adapter (throw the message away), and yes, your Orchestration will still get the good response as well as the exceptions.
Update the send port that handles routing errors from other send ports that we do want to go to our exception handing to exclude those send ports which we are handling via an Orchestration.

Jhipster exception handling in services

i am currently trying to understand the exception handling in JHipster.
I want to throw an exception in a service. The exception message shall be translated in the UI and parameters shall be set for the message. The CustomParameterizedException would fit perfectly. But from an architectural perspective, i think i can't use it in a service, as the exception is located in the web package. Why is it located in the web package? I would expect it to be in an own package exception or similar, so it can be accessed from every layer in the application.
I've also seen in the ExceptionTranslator.processRuntimeException method, that any RuntimeException can be handled, if the ResponseStatus annotation is set on the Exception. As far as i can see, the translation in the UI will only be done based on the error code. So i cannot use it for custom error messages, that i need.
How do you do the exception handling in other layers than the web layer in a jHipster application?
Thanks for your help in advance!
CustomParameterizedException is in a web package because it uses ParameterizedErrorVM which is a view model which gets serialized in JSON and used by Angular part of your app. This is generated code, feel free to change it to fit your needs.
Spring MVC offers several ways to handle exceptions as shown in this blog post.
You could also uses AOP to implement a default processing like logging or translating exceptions, see LoggingAspect in your JHipster app.

Intercept Http Endpoint Exception [Mule ESB]

I'am using Mule 3.3.0 CE and I would have a custom behaviour when an exception is thrown in an http outbound endpoint (i.e when I get a Connection Refused Exception or Connection Timeout Exception). Let's assume that I have this scenario: a SOAP Component and a Http Outbound Endpoint that realize together a cxf service client and let's assume that I can't use any exception strategy.
I would write an Interceptor which intercept the http exception (i.e Connection Refused) and in which I can write a custon behaviour (i.e send the message in a queue).
I need of an interceptor that intercept che http exception and no a SOAP Fault (that could be intercepted with a SOAPFaultInterceptor).
How can I realize this model?
Thank you all for any help
I found the solution. I used a custom interceptor ( component) just before the Http component and I extended the AbstractEnvelopeInterceptor that gives to me the possibility to work before, after and during the component is processing the message.
With this perspective, I implemented the last method. This method's sign contains a boolean value that is setted is an exception occurred. In this way I can leverage this method to handle any kind of exceptions that is related to Http Component.

Coldfusion: How to handle cfftp exceptions

I'm using Coldfusion version:8. I need to handle cfftp exceptions, which handles invalid credentials, connection timeout, no upload permissions, no delete permissions. what is the exact defined runtime exception for cfftp tag in Coldfusion.
Try using cftry tag:
<cftry>
FTP code here.
<cfcatch type="exception type1">
Add exception processing code here.
</cfcatch>
<cfcatch type="exception type2">
Add exception processing code here.
</cfcatch>
<cfcatch type="Any">
Add exception processing code appropriate for all other exceptions here.
</cfcatch>
</cftry>
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Errors_13.html
Exception handling isn't going to help you if your request is served by the targeted webserver. Exceptions are only thrown if something unexpected occures while trying to send the request by ColdFusion, i.e. outgoing firewall blocks your request or any other kind of connection issue.
The only thing you need is the CFHTTP struct variable that is always generated after calling the tag. This struct contains all data related to the actual HTTP response. (Keeping the request within <cftry>/<cfcatch> is still suggested though.)
Here's an example requesting a non-existent website (404 Not Found) on Tomcat/Railo:

Get stacktrace from Java (Apache Tomcat) backend on Flex frontend (connected by BlazeDS)

I'm using BlazeDS to connect my Flex front end to my Java backend, and was wondering if there is any way I can get the complete stack trace in case of an exception to be passed to the front end. When I set a break point in the exception handler in Flex, I just see a basic message, fault string etc.
Would appreciate any help.
Thanks!
You could create a custom exception; then catch all serverside exceptions at highest level and rethrow your custom exception with the stacktrace of the original exception as a property. You should be able to access this clientside.
Also, if you're using Spring on the server side, the Spring BlazeDS integration can translate server-side exceptions into cleaner client-side ones using exception translators.