Generic error handler

Im looking to implement a generic error/Exception handler centrally to this fairly large system.
The error messages displayed to the user are also quite complex and will have to be created by the handler.
If anyone has any ideas or can perhaps point me into the direction of a pattern etc it will be much appreciated.
Thanks a million!!

On a system I wrote previously, I used this.
First, I have a series of classes that encapsulate user-readable messages.
/** a message is a serialisable object.
It's toString() method returns the text of a message
suitable for being displayed to a user. */
abstract class Message implements Serializable {}
/** ToHtml tags an object as having a toHtml method. */
interface ToHtml
  /** This method returns a string suitable for insertion into a
      JEditorPane with a content tyhpe of text/html, or for inclusion
      into a web page. */
  public String toHtml();
class MessageList extends Message implements ToHtml {
List messages = new ArrayList();
void addMessage(Message msg) { ... }
void addAllMessages(MessageList lst) { messages.addAll(lst.messages); }
/** concatenate the messages into a list separated by line breaks. */
String toString() {}
/** concatenate the messages into a HTML UL list. Use the toHtml on each message
     that implements it. */
String toHtml() {}
/** a message that uses java.text.MessageFormat to format the params */
class ParameterisedPlainMessage extends Message {
  java.text.MessageFormat pattern;
  Object[] arguments;
  String toString() { return pattern.format(arguments); }
/** A message that includes both a plain-text format and an HTML format */
class ParameterisedHtmlMessage extends ParametrisedPlainMessage implements toHtml {
  java.text.MessageFormat htmlPattern;
  String toHtml() { return htmlPattern.format(arguments); }
}To create these message objects, I use a message factory:
class MessageFactory {
   String pattern;
   String htmlPattern;
   MessageFactory(String message_key) {
     // get the message format for plain text
     // get the message format for html 
   MessageFactory(Class clazz, String message_key) {
      this(clazz.getName() + "." + message_key);
   Message create(Object[] args) {
     if(we have an html pattern) {
        return new ParameterisedHtmlMessage(pattern, htmlpattern, args);
     else {
        return new ParameterisedPlainMessage(pattern, args);
   Message create(Collection args)  { ... }
   Message create()  { ... }
   Message create(Object arg1)  { ... }
   Message create(Object arg1, Object arg2)  { ... }
   Message create(Object arg1, Object arg2, Object arg3)  { ... }
   Message create(Object arg1, Object arg2, Object arg3, Object arg4)  { ... }
   // etc etc
}The text of the message formats will typically be in a resource bundle, some XML, or a properties
file. The key of the message is usually a class or package name followed by an upper case
identiier. If the message is only ever created in one particular class, then I use the class name,
otherwise the name of the most reasonable package.
Finally, the message formats end with an optional .plain or .html
You use them like this:
class Foo {
   private static final Message CANT_DO_THIS = new MessageFactory(Foo.class, "CANT_DO_THIS");
   private static final Message OK = new MessageFactory(Foo.class, "OK");
   Message bar(int because) {
     return because == 0 ? OK.create() : CANT_DO_THIS.create(new Integer(i));
}with a properties file like this:
quux.baz.Foo.CANT_DO_THIS.plain=Can't do this for a value of {0}.
quux.baz.Foo.CANT_DO_THIS.html=<FONT color=\"red\">Can't do this</FONT> for a value of <B>{0}</B>.
quux.baz.Foo.OK=All Ok.Now then. As to the question of exceptions.
We have to distinguish between serious exceptions and exceptions that arise as part of normal processing. For instance, if one EJB gets a RemoteException when calling anoter, then this is
serious. For these things, I use a class ContainerException which extends EJBException. EJBException is an unchecked exception, and always triggers a rollback of left uncaught.
ContainerException has a constructor on it that takes a RemoteException (among others), and which
spits out an WARNING level log line when it is constructed.
For exceptions that arise as part of normal processing, I create a class BusinessException
abstract class BusinessException extends Exception {}I have a concrete subclass of this:
class MessageException extends BusinessException {
  Message msg;
  MessageException(Message msg) {}
  /** override getMessage */
  String etMessage() { return msg.toString(); }
  Message getMessageObject)( { return msg; }
}If you want to catch specific business events, you can subclass this:
class OutOfMoneyException {
  static MessageFactory OUT_OF_MONEY =
     new MessageFactory(OutOfMoneyException.class, "OUT_OF_MONEY");
   Person p;
  OutOfMoneyException(Person p) {
    super(OUT_OF_MONEY.create(p));
    this.p = p;
  Person getPerson() { return p; }
}Or you can just build instances of MessageException without worring about subclassing them.
class Account {
  static MessageFactory ACCOUNT_CLOSED =
     new MessageFactory(Account.class, "ACCOUNT_CLOSED");
  static MessageFactory ACCOUNT_LOCKED =
     new MessageFactory(Account.class, "ACCOUNT_LOCKED");
  void makeWithdrawal(int amt) throws BusinessException {
     if(account is closed)
     throw new MessageException(ACCOUNT_CLOSED.create(this));
     if(account is locked)
     throw new MessageException(ACCOUNT_LOCKED.create(this));
     if(coh < amt)
       throw new OutOfMoneyException(getPerson());
     coh -= amt;
class DoSomeStuff {
  void doSomeStuff() throws BusinessException {
    boolean need_to_rollback = false;
    MessageList problems = new MessageList();
    for(wdl in withdrawal list) {
      try {
         wdl.getAccount().makeWithdrawal(wdl.getAmount());
      catch(OutOfMoneyException ex) {
        problems.add(ex.getMessageObject());
      catch(BusinessException ex) {
        // business exptions other than out of money mean
        // we must do a rollback.
        problems.add(ex.getMessageObject());
        need_to_rollback = true;
    if(need_to_rollback) transaction.rollBack();
    if(!problems.isEmpty()) throw new MessageException(problems); 
    // else, all ok.
}And that about does it. You can then call popUpError(), which will use a JEditorPane to
display the message in HTML to the user, so your messages may be as visually complex as you
wish.

Similar Messages

  • How to create a generic error handling proxy?

    Hello,
    i have few services proxies.
    I want to create a generic error handling osb proxy which does only errorhandling.
    This proxy would be called by all my services.Now suppose my services proxies would throw any error,the control will pass to error handling block of proxy..from there i will call this generic errorhandling proxyusing a service callout or publish action.In this proxy i want to do all my error handling based on 'n' conditions.and i want to pass the message to the fault variable of services proxy..kindly suggest ways..*main challenge is passing the message to the fault variable of services proxy*

    Hi,
    For generic error handling framework or common error handling framework...create a bpel process which takes the error details payload and sends the inf/data as email to the particular receipients.
    create business process with bpel process and proxy using business service.so wen ever error occurs at stage or route or proxy level ..call error handler action in OSB.Assign error handler details to the bpel input payload.
    FOR EX:
    <soap-env:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <com:test>
    <com:ProcessInfo>testDetails</com:ProcessInfo>
    <com:BusinessProcessName>testprocess</com:BusinessProcessName>
    <com:BusinessProcessInstanceId>{fn-bea:uuid()}</com:BusinessProcessInstanceId>
    <com:BusinessProcessStep>ReqLayer</com:BusinessProcessStep>
    <com:ErrorCode>{string($fault/ctx:errorCode)}</com:ErrorCode>
    <com:ErrorType>Technical</com:ErrorType>
    <com:StatusCode>Error</com:StatusCode>
    <com:ImplementationCode>OSB</com:ImplementationCode>
    <com:ErrorDescription>{string($fault/ctx:reason)}</com:ErrorDescription>
    <com:ErrorDateTime>{fn:current-dateTime()}</com:ErrorDateTime>
    <com:Node>{string($fault/ctx:location/ctx:node)}</com:Node>
    <com:Path>{string($fault/ctx:location/ctx:path)}</com:Path>
    </com:test>
    </soap-env:Body>
    this assign the error details values to the bpel process.

  • Generic error/exception handler

    Well guys, I think I got a challenge for you: I have been thinking for some time about the idea of having a generic error handler for my applications. It's one of these things you should just have: In large GUI apps you usually try to catch all exceptions and display some sort of nice error dialog telling the user what went wrong and what he has to do now. However, there are runtime errors that one can't foresee. These might be bugs, sure, but they happen, so there should be a way of dealing with them. For example, let's say there is a NullPointerException. The clean way would be to display a message box saying something like "Bug!" and giving the user the chance to save his work (or do that automatically). However, this does not seem to be possible. Sure, I could surround every method code with a try { ... }catch(Exception e) and display the dialog, but that seems rather tedious. Does anyone know a better way? Like a common error handling method that is always called when there is an uncaught exception. I dunno, but my IDE JBuilder has something like that, because it is able to stop at "all uncaught exceptions". Any suggestions?
    Thanks guys, or do we have to file a RFE???
    Filip Rindler

    Well, that doesn't work for GUI apps as their main method is done after initializing and all other work is done by the event dispatch thread that is responsible for receiving OS messages (such as mouse motion / clicked / ...). Then this thread calls the event listener methods of registered listeners. It's actually a little more complex how AWT/Swing handles things, but that's the general concept and it is the core of the problem as well: I cannot change any of the event dispatch code (it's deep down in the AWT), so therefore I cannot catch any exceptions there. But maybe there's a hook...

  • Using Error Message in BPM Error Handling Branch

    Hello,
    I closed the old BPM thread not to mix up different questions.
    As I found out now a synchronous Send Step with Eror handling branch is working fine to directly handle errors.
    As in the send step there could be several errors possible, e.g. XML validation fails, error in communication channel etc.
    Is it possible to have access to the error message that can be seen in monitoring and use this as input parameter for message mapping for example?
    Would be helpful because otherwise I just would be able to send back a generic error message to the sender.

    Hii Florian,
    Adapter module can only provide information about the failures in Adapters.
    But other failures like XML Validations, can be informed depending on the mode of Validation.
    As per help.sap.com
    You can perform the structure check at the following points in PI message processing:
    ●      Validation in the sender adapter
    If the sender adapter has created the PI message, you can then perform the validation of the PI payload. If the structure of the payload differs from the definition of the data type provided for comparison, message processing is stopped. The adapter sends a synchronous response to the sender of the message, informing it about the structure error. The industry-specific adapters inform the sender asynchronously, as required by the RNIF protocol and the CIDX protocol.
    ●      Validation in the Integration Engine
    In inbound and outbound processing, *validation of the PI message payload takes place as a pipeline step *of the Integration Engine. If the structure of the message payload does not match the saved definition of the data type, an error description is generated. The error description contains status information and a list of all structure errors. Message processing is stopped. The message is set to error status and an error report is saved.
    If validation takes place in the Integration Engine, the sender of the message is not automatically informed of the structure error. The message is set to error status and an administrator can process the message further using the Runtime Workbench.
    So if you use XML Validation in Sender Adapter you can get back the Exception ( i think you need to do some java mapping here). Else if you are using Integration Engine, then alerts are there for them.
    Anyway this discussion has opened a lot of To Be Explored area for me. I will keep looking for them.
    Regards
    Suraj

  • Error Handling in OSB

    Hi,
    In OSB how to catch all different errors and send them to specific
    For ex:
    1.if i get a "file not found" error, i need to send an email notification
    2.if i get an arithmetic error , i need to send it to database
    like any other errors...
    Can we handle all those errors in a single error handler and send them to specific targets
    let me know any questions

    basically what is did is create a generic proxy service which will contain all the logic to handle your faults.
    so in your case you could create a soap or xml proxy service (let's name it ErrorHospital).
    the input of this proxy service needs to contain all the data you need to decide what to do with a certain error.
    for now let's make the interface something like
    <errorMetadata>
    <error>{$fault}</error>
    <payload>{$body}</payload>
    </errorMetadata>you could just add me metadata from the proces which is failing ofcourse, it's up to you to decide what data you need.
    now in for example the EmployeeService something fails.
    In the EmployeeService you add a service error handler, and for the start in this service error handler we will only do a publish to our new 'ErrorHospital'.
    Create the <errorMetadata> element in here and do the publish.
    At this stage we have all the metadata available in our ErrorHospital proxy service, so we can execute all the logic needed for any specifica error.
    In the ErrorHospital proxyservice you could add something like
    if $body/errorMetadata/error/faultCode = 'MAIL-001' then send mail (by use of a mail transport business service (this expression won't work, but just to show what's possible)
    in my blog i used a ErrorRepository in which i configure what actions to execute based on the errorCode
    so you could add MAIL-001 in this repository and define something like
    log_YN = Y
    mail_YN = Y
    report_YN =N
    the generic logic in your errorHospital proxy service will contain a list of
    if - then - else combinations to decide if it should mail, or if it should log or if it should report
    and this will work on every errorCode you define in the ErrorRepository.
    It's a solution we use at my current customer too and works pretty nice, and the administrators can update the ErrorRepository file from the console on production if they decide on a certain moment that they need logging on some errorCode for example
    hope it's a bit clear like this

  • Custom inbound Idoc error handling/ Workflow

    Dear Experts,
            I have a requirement where in I created a custom inbound idoc, but now i need to handle the errors in the workflow and notify the users thru workflow on an error.
    Can some one please provide me a step by step guide on how to create a organizational unit, position and assign users to the position... and any other steps that need to be configured to notify the user on the error.
    I'm pretty new to all these organizational uints and workflow related stuff. Any step by step would really be helpful.
    Thanks for your time.
    -Amit.
    Moderator message: sorry, these forums cannot replace proper training, if there is step by step guides out there, then please use the search functions.
    Edited by: Thomas Zloch on Oct 31, 2010 11:50 AM

    Vittal,
    1. If your requirement is for a SAP Standard Basic Message type and a Z extension: Then you simply have to find out the 'Standard Task' associated with basic type. You shouldn't worry about extensions. The standard task will be triggered at input error.
    2. If your requirement is for a Z basic type i.e. you have created a customer IDOC for a custom processing: There are many dependencies on how you can achieve this. Firstly, you need to know how you're are processing this Z_IDOC. Are you using a standard FM or custom workflow or custom FM? There should be some triggering event within the processing of this Z_IDOC which will raise a certain flag when the error you want to capture happens (or when there is a generic error). You can configure this event in binding objects to trigger a workflow task. If you take a look at any standard tasks, you'll get an idea how the triggering event happens.
    Once the workflow task (you can use custom task or use a standard task i.e. by triggering a standard event within the IDOC processing program) is triggered, you can either send it to SAP inbox, e-mail, trigger another processing etc. This is altogether another story.
    So bottomline: For custom IDOC processing, you need to trigger an event when error happens. This can be a custom event or a standard event. This event should be linked to a task (custom/standard - check in SWETYPV). Bind all of these in PFTC. Once the task is triggered, you can do whatever you want to do with it.

  • JDev 11.1.1.2.0 - Error while providing Error Handler Class in Databindings

    I get this exception as soon as I provide a reference to ErrorHandlerClass in DataBindings.cpx
    Error 500--Internal Server Error
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.InstantiationException, msg=empexceptions.model.EmpDCErrorHandler
         at oracle.jbo.common.JBOClass.newInstance(JBOClass.java:253)
         at oracle.jbo.uicli.mom.JUApplicationDefImpl.initializeBindingContext(JUApplicationDefImpl.java:1242)
         at oracle.jbo.uicli.mom.JUApplicationDefImpl.populateContext(JUApplicationDefImpl.java:1215)
         at oracle.jbo.uicli.mom.JUMetaObjectManager.loadCpx(JUMetaObjectManager.java:713)
         at oracle.adf.model.BindingRequestHandler.initializeBindingContext(BindingRequestHandler.java:399)
         at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:182)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:189)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.InstantiationException: empexceptions.model.EmpDCErrorHandler
         at java.lang.Class.newInstance0(Class.java:340)
         at java.lang.Class.newInstance(Class.java:308)
         at oracle.jbo.common.JBOClass.newInstance(JBOClass.java:245)
         ... 34 more
    DataBindings.cpx looks like this
    <?xml version="1.0" encoding="UTF-8" ?>
    <Application xmlns="http://xmlns.oracle.com/adfm/application"
                 version="11.1.1.55.36" id="DataBindings" SeparateXMLFiles="false"
                 Package="empexceptions.view" ClientType="Generic"
                ErrorHandlerClass="empexceptions.model.EmpDCErrorHandler">and my error handler class looks like this
    package empexceptions.model;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCErrorHandlerImpl;
    public class EmpDCErrorHandler extends DCErrorHandlerImpl {
        public EmpDCErrorHandler(boolean b) {
            super(false);
        @Override
        public void reportException(DCBindingContainer dCBindingContainer,
                                    Exception exception) {
            super.reportException(dCBindingContainer, exception);
    }Am I doing anything wrong here?

    hi Harry
    See "28.10 Customizing Error Handling"
    at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/web_adv.htm#ADFFD1398
    that says "... The exception error handler must have a default constructor, as shown in Example 28-27. ...".
    success
    Jan Vervecken

  • Conditional  Error handling

    This is my use case
    My proxy will call a business service which will call the DB and execute a SP . The SP will return 1-* rows. Assume the rows have 10 columns. The 10th column is the status. even if there is some functional error the SP will return 1 row with the 10th columns populated.
    This is the possible values of the 10th column (Status)
    OK, E1, E2,E3, D
    OK - Output is ok . I will transform the output and call another BS to insert into another DB
    D- Discard . just skip the message flow . no need to insert into the DB.
    E1 ,E2- Retry 2 more time with an interval of 1 min. but I need to log the original body
    E3 - Retry 2 more time with an interval of 1 min. but I do not need to log.
    I have created 2 proxies and 2 BS.
    P1 -> P2 - > BS1. For the service callout of P2 from P1 I have set the routing option for Retrycount = 2 , retyinterval=60 secs.
    P2 will call BS1 and check the output Row1 and column 10 index and based on that it will do the following. For E1,E2,E3 it will raise Error with Error code E0001, E0002, E0003 . For D and OK it changes the body accordingly.
    In P1, I put and if condition to validate the return of P2. For OK I call BS2, For D I call the Skip action
    For E1,E2 and E3 they get trapped in the Stage error of P1.
    Everything works fine till here, but how do I identify in stage1 error handler if the error is caused by E0001 or E0002 or E0003 so I can log the original body and log the cause of the error is E0001 or E0002 ???
    regards

    This is the $fault output
    <con:fault      xmlns:con="http://www.bea.com/wli/sb/context">
         <con:errorCode>BEA-382502</con:errorCode>
         <con:reason>
         OSB Service Callout action received an error response
         </con:reason>
         <con:details>
         <con1:ErrorResponseDetail      xmlns:con1="http://www.bea.com/wli/sb/stages/transform/config"/>
         </con:details>
         <con:location>
         <con:node>PipelinePairNode1</con:node>
         <con:pipeline>PipelinePairNode1_request</con:pipeline>
         <con:stage>stage1</con:stage>
         <con:path>request-pipeline</con:path>
         </con:location>
         </con:fault>
    It does not give me the Error code which is raised in my service callout proxy.
    Let me try and simply my scenario.
    Proxy 1 calls Proxy2 by service callout . Proxy 2 based on certain error condition will raise error code like E0001 , E0002 etc..
    In Proxy 1 Error handler, I want to find out if the error is caused because of E0001 or E0002. How can I achieve this ?. I have posted Proxy 1 $fault variable which outputs a generic error message.

  • Best error handling for visa calls?

    We are using some handlers we've devloped for power supply handling (over GPIB). The power supplies are SCPI and use SCPI/GPIB commands. The handlers use the NI visa api's Read() and Write() functions to send the commands.  They work fine, for the most part, and we've been using them for a number of years.
    However, we're hearing reports that there may have been a few times that commands were not executed on the power supply and our handler did not report back any error.
    So, I'm trying to update these handlers to add a little error checking to make them more robust and hopefully we'll catch this error if it happens again.
    For error handling, I've come up with 3 solutions and tried all 3. I find some benefits and drawbacks with each and hoped I could get your opinions about error handling as I'm not overly familiar with some of the methods.
    Method 1:
    Set the Event Status Enable register to catch all events (or all that I care about).
    Read status byte (STB?) after each command and check the event bit and then event status bit if event bit set.
    Drawback1: I have one power supply that does not implement this correctly and a second type that appears to not be working correctly either.
    Drawback2: Errors are generic. I'll know if I got, for example, a DDE (Device Dependant Error), but I won't know more detail than that.
    Method 2:
     After each command sent, read the error queue with the System:Error? query.
    Drawback: It seems I get a lot of messages back in this method that aren't real errors. It's very "noisy" and I have no way to distinguish real errors from "noise" messages like "query interrupted" and such.
    Method 3:
    Check the return code of the Visa Read() and Write() commands. At first I didn't think this was very robust, but after seeing the list of errors here, I'm beginning to think that these might be more robust and detailed than Method 1. However, I'm not sure.
    So is method 3 as robust as it looks, or is there a combination/comprimise I can make, or another method I did not mention which is best to trap errors from Visa Reads/Writes to these GPIB power supplies? Keep in mind that the handlers work for a number of different power supplies and its likely that some things may be implemented differently between supplies....so its best to stick with somethind standard that will work on all power supplies.

    Hi KingTermite,
    I hope you will got answer of the question and may be implemeted something .It was really a nice discussion .I am also facing the same issue where I am communicating with different instrument using  GPIB communication and RS 232 too.
    Can you share and discuss about the implementation of your initiative.
    Best Regards
    Regards:
    Vaibhav Kanchan
    Sr. Engineer
    NI Certified LabVIEW Developer(CLD)
    NI Certified TestStand Developer(CTD}

  • General Error handling

    I've managed to get myself confused with error handling in Forms 6i.
    If I have a trigger that does a 'commit-form' like this
    commit_form;
    IF NOT form_success THEN
    RAISE form_trigger_failure;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN;
    END;
    and the commit_form fails due to a mandatory field being missing (or similar) then what happens first?
    Does my ON-ERROR trigger fire?
    Does the form_success check fail and raise form_trigger failure?
    Does my exception block get used?
    Or does more than 1 happen??
    I could - of course - find the answer to this through debug but I'm looking for a more generic answer if possible.
    Thanks - Sean.

    What happens first?  The forms validation process runs and informs user that the field is required.
    Does On-Error fire?  Yes, if you have one in your form.
    Does the form_success check fail and raise form_trigger failure?  Yes -- but ONLY if your On-error raises Form_trigger_failure.  If it does not, you have lots of problems.
    Does my exception block get used?  Yes.  Raising Form_trigger_failure causes control to pass to the exception handler.  But I never use an exception handler except when I code SQL commands.
    Now...  After commit_form, you should also check Form_Status.  Read the help topic on the Form_Success built-in.
    My standard C00_Commit program unit does this:
      COMMIT_FORM;
      IF :SYSTEM.FORM_STATUS <> 'QUERY'
      OR NOT FORM_SUCCESS THEN
        RAISE FORM_TRIGGER_FAILURE;
      END IF;
    END;

  • Generic Exception handler in java

    We have developed a client java application with our own exception hierarchy derived from java.lang.exception. We raise our own exception in case of error scenarios. But there is one additional thing which we want to do:
    1. When ever any exception is raised in our exception we want to do some generic exception handling (like kicking of some module which collects the log files and send it to the administrator.
    2. We want the above activity to happen also when any runtime exception is raised. We are not catching any runtime exception and we have no handle for this.
    How should we go about this. Can we write a very low-level generic exception handler?
    We do not want to have done at every catch block we have in our code. I mean we want to have some hook at a very generic place.
    Let me know if some body can be help me on this.

    As far as I know, for exceptions that are caught, you must make a call to a generic handler in the catch block, or you may rethrow the exception as a RuntimeException, and let it propagate.
    For RuntimeExceptions and Errors in threads that you create, the easiest way to solve this is to subclass ThreadGroup, override uncaughtException with the appropriate code, and create all your threads in this group. For a thread like main, have the first thing in the thread be the creation of a new thread in the new group, then pass control to that thread. For fixed threads, like the event queue, someone had a suggestion already. Note that uncaughtException is only called just before the thread ends, so an exception that shouldn't end the thread should be handled seperately.

  • Generic Error at Image Mapping at CRXDE Component Extractor

    When I try to map a image from this website I just imported at CRXDE Lite at CQ5.4 (Component Extractor), I got this generic error message.
    I've already try to map the image with image component, flash component and others, everytime with the same error.
    Both the component folder and the Path folder exists. Can somebody help me?

    Here's the error.log output for this situation:
    14.03.2012 14:43:04.060 *ERROR* [0:0:0:0:0:0:0:1 [1331746984029] POST /libs/wcm/bin/siteimporter/generate HTTP/1.1] com.day.cq.wcm.siteimporter.servlet.PageGeneratorServlet Could not generate page component java.lang.IllegalArgumentException: relPath is not a relative path: {}
    {}etc
    {}designs
    {}logo.jpg
    at org.apache.jackrabbit.spi.commons.name.PathFactoryImpl.create(PathFactoryImpl.java:47)
    at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:62)
    at org.apache.jackrabbit.core.session.AddNodeOperation.perform(AddNodeOperation.java:37)
    at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
    at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
    at org.apache.jackrabbit.core.NodeImpl.addNodeWithUuid(NodeImpl.java:1783)
    at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1735)
    at com.day.cq.wcm.siteimporter.util.PageGenerator.replace(PageGenerator.java:175)
    at com.day.cq.wcm.siteimporter.servlet.PageGeneratorServlet.doPost(PageGeneratorServlet.java :113)
    at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.ja va:148)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.jav a:344)
    at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.jav a:375)
    at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:529)
    at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilter Chain.java:45)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:64)
    at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:146)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:308 )
    at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:141)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProce ssorImpl.java:269)
    at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChai n.java:49)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:64)
    at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:185)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgre ssTrackerLogFilter.java:59)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.j ava:220)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at com.day.cq.theme.impl.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:67)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:96)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:119)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:84)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.portal.container.internal.request.PortalFilter.doFilter(PortalFilter.jav a:76)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServle tStarterFilter.java:135)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processRequest(SlingRequestProcess orImpl.java:161)
    at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:183)
    at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:9 6)
    at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)
    at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java: 42)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:49)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)
    at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java: 48)
    at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)
    at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.felix.http.proxy.ProxyServlet.service(ProxyServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.sling.launchpad.base.webapp.SlingServletDelegate.service(SlingServletDelegate. java:277)
    at org.apache.sling.launchpad.webapp.SlingServlet.service(SlingServlet.java:148)
    at com.day.j2ee.servletengine.ServletRuntimeEnvironment.service(ServletRuntimeEnvironment.ja va:228)
    at com.day.j2ee.servletengine.RequestDispatcherImpl.doFilter(RequestDispatcherImpl.java:315)
    at com.day.j2ee.servletengine.FilterChainImpl.doFilter(FilterChainImpl.java:74)
    at com.day.crx.launchpad.filters.CRXLaunchpadLicenseFilter.doFilter(CRXLaunchpadLicenseFilte r.java:96)
    at com.day.j2ee.servletengine.FilterChainImpl.doFilter(FilterChainImpl.java:72)
    at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:334)
    at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:378)
    at com.day.j2ee.servletengine.ServletHandlerImpl.execute(ServletHandlerImpl.java:315)
    at com.day.j2ee.servletengine.DefaultThreadPool$DequeueThread.run(DefaultThreadPool.java:134 )
    at java.lang.Thread.run(Unknown Source)
    I've already tried the follow paths to my component:
      /etc/designs/
      /etc/designs (with and without last character "/")
      /etc/designs/logo.jpg
      /etc/designs/test (with and without last character "/")
      /etc/designs/test/logo.jpg
    Can anybody help me figure out what's going on?
    Thanks.

  • Generic Exception Handler/Listener

    All,
    I have a web application and I want to create a generic exception handler/listener which will listen to all the exception(checked and runtime) which are thrown by web application.
    Any idea how can I do this?
    Regards.

    797836 wrote:
    Hi,
    I want to build a generic exception handler which can be reused in any java j2ee applications. Unlikely. Probably impossible.
    I have java application which is communicating with other 3rd party applications like webservices, webmethods , etc from where we are getting an errorcode which will be used in our java application to do a lookup to get the respestive error message from the resource bundle. Please clarify in such case how I can go with a generic exception handler which will be build separately and will be integrated with Java applications to handle the exceptions and errors.An excellent example of why a universal exception handler wouldn't work.
    At some point a call tree looks like A->B->C, where C (or beyond) that is where your communications problem occurs. The impact of that depends on the application.
    For example if a user types in a url (at A) and the server (C) fails to resolve it then that is a user problem.
    However if nightly batch process expects to download an update file every night from one location and it can't connect then that is an operations error (or notification/alert.)

  • A generic error occurred in GDI+ while assing tiff image file to Bitmap and Image

    Hi,
    I am getting "A generic error occurred in GDI+" error while reading the tiff image file to Bitmap or Image.
    Below is my sample code.
    string filePath=@"c:\Images\sample.tif";
    Bitmap bmp=new Bitmap(filePath);   // here getting exception
    int totalpages=bmp.GetFrameCount(.....);
    etc......
    I tried using Bitmap.FromFile() and also from FromStream() even for Image also but there is no use.
    Moreover i m having full permissions for the file path and the tiff file is having multiple pages.
    Can anyone help me to solve this issue please.
    Thanks & Regards,
    Kishore
    Kishore

    Make sure that the Tif file is valid (can other software open it)?  If you are able to save a Tif using GDI+, try saving that Tif, then opening it.  Part of me wonders if there is something about that specific Tif that GDI+ doesn't like.
    You could also try using WIC to open the TIF, perhaps you would have better luck there.

  • How to take control back from service error handler in osb

    I am using osb to send data to multiple services at the same time.since x query is a procedural language if any single operation fails the flow goes to service error handler which calls a BPEL webservice and logs the error in a database but the control doesnt comes back to my code I have tried everything including RESUME,REPLY operations but all in vain similarly i cannot use service callout call to my business service because its not allowing to select my BPEL wsdl operation

    If your statement "the control doesnt comes back to my code" means you expect that your xquery will continue in processing than your expectations are just too high. :-)
    Resume action is supposed to resume the next action in the message flow. It means the action that follows the action which caused an error.

Maybe you are looking for

  • Home sharing on but, can not share from laptop to desktop.

    I am trying to share songs from my iTunes account to my husbands. I am on my Macbook and he is on the desktop. We both followed the directions given through iTunes but we are still unable to import from each other. His library opens completely on my

  • Software Update and Disk Utility no longer work (Leopard)

    Hello. After upgrading yesterday from 10.4.11 to 10.5.0 then updating to 10.5.1 I find that repair / verify permissions no longer works (it just hangs after starting). And the same with Software Update, it starts the check then just hangs. Grateful f

  • HDR window too big for screen

    When I open the "Merge to HDR Pro" dialog box, it is too big for the screen and I cannot resize it. Pressing the green + button just resizes the too big screen above my dock, but it is still too big for the options that lie at the bottom of the dialo

  • Menu becomes inactive.

    When i try to add or import anything, no window opens and all selections in the menus become inactive (grey)

  • Butterscotch toolbar wont uninstall

    I accidently installed the Buterscotch toolbar. I have deleted it from Tools|Add-ons|Extensions and in Control panel|Add Remove Programs also remove the Folder in My Programmes but it delays opening Firefox while it tries to run a script. Chrome://ta