Simple Error Handling Question

I know that in general, when you are handling an error, you can either pass the back by adding a throws declaration to the method in question, or surround with try/catch and handle the error.
What do you do if you want the error to force the application to stop? Just send a simple output message and then stop.
Thx,
hqd

What do you do if you want the error to force the
application to stop? Just send a simple output
message and then stop.You should stop wanting that. If the code in method X
encounters an error it can't deal with, it should
throw that error to whoever calls it. It is the
responsibility of the caller to decide what to do,
not the responsibility of method X.But the buck has to stop somewhere. Are you saying that only the main method should ever stop a program?
Maybe this is one of the gaps in my understanding of good overall design, but it seems perfectly valid to me to have certain methods that, when they error, I know I always want my application to stop. Passing it along up the chain might involve adding a whole bunch of throws declarations.... why... just to say we have no methods that stop the application. Say this piece of code is not longer used in the spot that throws it's possible error up the chain.... now you have to remove all those throws.... isn't this ripple effect on our code bad design?
What am I missing?
Thanks,
hqd

Similar Messages

  • General Labview Error Handler question discussion

    Recently two functions were brought to my attention, the General Error Handler and the Simple Error handler. 
    And I cannot wrap my hand around these two features.  While I have been using Labview I have always used the Labview error cluster.  When would you use these two features?  As I feel the cluster error is much help. 
    Maybe it is my defnition that I have confused: 
    The general error handler will display a dialogue box describing the error that will be passed and shuts down the code? 
    The simple error handler notifys the operator that an error has occured but it can be customized for adding functionality, it takes the error cluster input and determines if an error was generated.  "If an error has been generated, the VI displays a dialog box with the error code, a brief description of the error, and the location of the error."   How is this not the same as an error cluster?  
    If anyone has any simple code examples for this or knowledge I greatly appriciate it. 
    Caleb

    Jacobson wrote:
    Psireaper9 wrote:
    The simple error handler notifys the operator that an error has occured but it can be customized for adding functionality, it takes the error cluster input and determines if an error was generated.  "If an error has been generated, the VI displays a dialog box with the error code, a brief description of the error, and the location of the error."   How is this not the same as an error cluster?  
    You are correct that they give the same information.  The difference is that if you want to use an error cluster you will need an indicator on your front panel.  If you use the simple error handler you won't have to have an error cluster on your front panel but the user will be notified if an error does occur.
    Think about all the programs you normally use (excel, chrome, etc.).  As a user you expect that errors aren't happening, and if errors do occur then the application will usually just close out and you get an error dialog about the error.
    I use the simple error handler with no user interaction to extract the error text.  Is there an easier way of doing that?

  • Page Error handling question..

    Using APEX 4.1.1.. Hosted instance.. I am testing various error handling functions (Oracle's standard one from documentation and others). I have a page with a standard report, I have defined the page to have an associated error handling function. On the report I have a calculated column that should error out due to a division by 0 error..
    Now what I had thought was, the page would handle the error more gracefully than previous version, in that it would show the custom error message I define in the constraints table...
    Is there a section of the documentation I am missing that shows at what point the error handling function kicks in and where we need to invoke it otherwise?
    Thank you,
    Tony Miller
    Dallas, TX

    Interesting. Had never considered this aspect.
    Just did a couple of tests - so it must only come into play from the PL/SQL engine.
    Created an sql report:
    select floor(dbms_random.value(1,10))/0 num
    from dual
    connect by level <= 10But the error function never gets hit.
    begin
    for i in (select floor(dbms_random.value(1,10))/0 num
    from dual
    connect by level <= 10) loop
    htp.p(i.num);
    end loop;
    end;Function gets hit.
    Just looking at the docs, there doesn't appear to be any indication of processing point.
    But from Patrick's blog:
    This includes errors raised by validation, process, … and all errors raised by the Application Express engine itself.http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-1/
    I guess an SQL report isn't considered as an 'all errors raised by the apex engine'.

  • Apex 4.1 Error handling question

    Apex 4.1
    Hi There,
    Just had a query regarding error handling. As per Apex documentation we can add more information to our error messages. I wanted to add custom text and also the actual Ora or any other message
    E.g
    begin
      if 1=1 then
        l_error := 1/0;
    end if;
    exception
    when others then
        APEX_ERROR.ADD_ERROR (
        p_message          => 'Error1',
        p_additional_info  => 'Test1',
        p_display_location => apex_error.c_inline_in_notification);
    end;Wanted to know, if we want to add the actual error message also, what do we need to add to the ADD_ERROR procedure? I wanted to record the sqlerrm message.
    Thanks

    The only problem with the example was I don't think it handles not null constraints real well. Usually have a constraint name like 'SYS_SOMENUMBER'. So as a result, the extract_constraint_name is not successful.
    I handled this by doing the following:
    if l_constraint_name IS NULL AND p_error.ora_sqlerrm IS NOT NULL THEN
         --NOT NULL constraints don't display the constraint name in the error, find another way
        --Added check for ora_sqlerrm as if there is a page validation, it still enters the function, but with no sqlerrm
            declare
                l_cons_split APEX_APPLICATION_GLOBAL.VC_ARR2;
                l_owner user_constraints.owner%type;
                l_table_name user_constraints.table_name%type;
                l_column_name user_cons_columns.column_name%type;
                l_table_column varchar2(400);
            BEGIN
                --get the section enclosed in parenthesis
                l_table_column := regexp_substr(p_error.ora_sqlerrm, '\([^)]*\)');
                --remove parenthesis and quotes
                l_table_column := regexp_replace(l_table_column, '[(")]');
                --split the data by period
                l_cons_split := apex_util.string_to_table(l_table_column, '.');
                --determine the constraint name by querying user_constraints
                l_table_name := l_cons_split(l_cons_split.COUNT-2);
                l_table_name := l_cons_split(l_cons_split.COUNT-1);
                l_column_name := l_cons_split(l_cons_split.COUNT);
                select uc.constraint_name into l_constraint_name
                from user_constraints uc, user_cons_columns ucc
                where uc.constraint_name = ucc.constraint_name
                and uc.owner = ucc.owner
                and uc.table_name = l_table_name
                and ucc.column_name = l_column_name
                and get_search_condition(uc.constraint_name, uc.owner) like '%IS NOT NULL%'; --gets the search condition as varchar
            END;
        END IF;{code}
    That's slightly off topic, but just thought i'd mention it :)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Fault and Error handling questions

    Hi,
    I have a few of questions regarding exception handling :
    1. Where can I find documentation (i.e. details and when thrown) on all the Standard faults available with BPEL ie. those in
    http://schemas.xmlsoap.org/ws/2003/03/business-process/" and
    http://schemas.oracle.com/extension
    2. Let's say I do not know in advance what specific fault to catch. I add a catchAll inside my scope. When catchAll triggers, I want to get the detail faultmessages of whatever fault caused the catchAll.
    3. I want to use a message type from the RuntimeFault.wsdl in my project. Should I copy over the wsdl file to my project folder ? If I do not copy over and import it from it's location (integration/orabpel/system/xmllib), the console is failing runtime when I try to render the input page.
    How can I do that ?
    Thanks
    Arindam

    You can find the standard faults from the BPELspec
    1.1.
    In 10.1.2.0.2 (the latest released version), youcan
    use some system xpath functions to extract thefault
    information in <catchAll> block:
    getFaultAsString( ) returns String
    Or
    getFaultName( ) returns QName as fault name.Hi Muruga,
    Thanks for your reply.
    Can you please also let me know :
    1. what's the signature of these methods ?
    2. I have 10.1.2.0.2 local version. However under
    catchall -> assign -> xpath expression builder, I do
    not see these 2 functions.
    Can you please help.
    ThanksHi Muruga,
    I tried doing the following :
    <faultHandlers>
    <catch faultName="bpelx:bindingFault" faultVariable="bindingFaultVar">
    <assign name="assignBindingFault">
    <copy>
    <from expression="concat(bpws:getVariableData('bindingFaultVar','code'),bpws:getVariableData('bindingFaultVar','summary'),bpws:getVariableData('bindingFaultVar','detail'))"/>
    <to variable="outputVariable" part="payload" query="/ns1:TransmissionAck/ns1:StackTrace"/>
    </copy>
    </assign>
    </catch>
    <catchAll>
    <assign name="assignCatchAll">
    <copy>
    <from expression=""Unexpected Error in the BPEL Process""/>
    <to variable="outputVariable" part="payload" query="/ns1:TransmissionAck/ns1:TransmissionText"/>
    </copy>
    <copy>
    <from expression="bpws:getFaultAsString()"/>
    <to variable="outputVariable" part="payload" query="/ns1:TransmissionAck/ns1:StackTrace"/>
    </copy>
    </assign>
    </catchAll>
    </faultHandlers>
    I got the following runtime error when an actual catchAll was caught :
    [2006/02/24 17:09:36] "{http://schemas.oracle.com/bpel/extension}remoteFault" has been thrown. less
    <remoteFault>
    <part name="code" >
    <code>17410</code>
    </part>
    <part name="summary" >
    <summary>file:/C:/OraBPELPM_2/integration/orabpel/domains/default/tmp/.bpel_WshOtmSyncInboundShipment_19.0.jar/WSH_OTM_INBOUND_GRP.wsdl [ WSH_OTM_INBOUND_GRP_ptt::WSH_OTM_INBOUND_GRP(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'WSH_OTM_INBOUND_GRP' failed due to: Error while converting to a Java array object. Unable to convert the XSD element P_INT_TRIP_INFO whose collection type is WSH_OTM_TRIP_TAB. Cause: java.sql.SQLException: No more data to read from socket ; nested exception is: ORABPEL-11801 Error while converting to a Java array object. Unable to convert the XSD element P_INT_TRIP_INFO whose collection type is WSH_OTM_TRIP_TAB. Cause: java.sql.SQLException: No more data to read from socket Check to ensure that the XML data describing the collection matches the definition of the array in the XSD. Contact oracle support if error is not fixable. </summary>
    </part>
    <part name="detail" >
    <detail>No more data to read from socket</detail>
    </part>
    </remoteFault>
    WS-T Complete
    WS-T Close
    WS-T Fault
    WS-T Cancel
    WS-T Compensate
    </sequence>
    <catchAll>
    assignCatchAll (faulted)
    [2006/02/24 17:09:36] Updated variable "outputVariable" less
    <outputVariable>
    <part name="payload" >
    <TransmissionAck>
    <EchoedTransmissionHeader>
    <TransmissionHeader>
    <UserName/>
    <Password/>
    </TransmissionHeader>
    </EchoedTransmissionHeader>
    <TransmissionAckStatus/>
    <TransmissionAckReason/>
    <StackTrace/>
    <TransmissionText>Unexpected Error in the BPEL Process</TransmissionText>
    </TransmissionAck>
    </part>
    </outputVariable>
    [2006/02/24 17:09:37] "XPathException" has been thrown. less
    XPath expression failed to execute.
    Error while processing xpath expression, the expression is "bpws:getFaultAsString()", the reason is function "bpws:getFaultAsString" not registered.
    Please verify the xpath query.
    </catchAll>
    WS-T Complete
    WS-T Close
    WS-T Fault
    WS-T Cancel
    WS-T Compensate
    <scope>
    WS-T Complete
    WS-T Close
    WS-T Fault
    WS-T Cancel
    WS-T Compensate
    </sequence>
    [2006/02/24 17:09:37] "XPathException" has not been caught by a catch block.
    [2006/02/24 17:09:37] BPEL process instance "4503" cancelled
    Can you please help.
    Thanks

  • HTTPService error handling question

    When i am using HTTPService for Flex-PHP communication i set
    HTTPService's 'fault' property which handles error event. So
    basically if i have HTTPService set up like this:
    <mx:HTTPService id="test" url="
    http://localhost/test/test.php"
    contentType="application/xml" useProxy="false" method="POST"
    fault="httpServiceError(event)">
    </mx:HTTPService>
    Then 'httpServiceError' method is fired in case of
    HTTPService error. What i would like to do in httpServiceError
    method is trace the id of the failed HTTPService. I tried with:
    public function httpServiceError(evt:FaultEvent):void{
    trace(evt.currentTarget.id);
    But soon realized that FaultEvent doesn't conatin
    'currentTarget' property so this failed. What's the correct way to
    find out id of the failed HTTPService?
    thanks in advance,
    best regards

    Which version of flex are you on?
    I'm not sure about version 2 but in Flex 3 fault event does
    have currentTarget property. What do you get in the trace if you
    just say event.currentTarget?
    from the docs:
    The FAULT event type.
    The properties of the event object have the following values:
    Property Value
    bubbles false
    cancelable true, calling preventDefault() from the associated
    token's responder.fault method will prevent the service or
    operation from dispatching this event
    currentTarget The Object that defines the event listener that
    handles the event. For example, if you use
    myButton.addEventListener() to register an event listener, myButton
    is the value of the currentTarget.
    fault The Fault object that contains the details of what
    caused this event.
    message The Message associated with this event.
    target The Object that dispatched the event; it is not always
    the Object listening for the event. Use the currentTarget property
    to always access the Object listening for the event.
    token The token that represents the call to the method. Used
    in the asynchronous completion token pattern.
    ATTA

  • Global error handling question.

    Hello! I've implemented error reporting logic in my app, so when some error occurs the email has been sent with error message, and error id. But it would be nice to locate error place (line number), i know that there is getStackTrace()  method of error obj, but it works only if I run app from Flex Builder. How we can implement it in release build app?
    Any help would be appreciated.
    Thank you.

    Moved to the Multiscreen development forum.  I don't know of a way to do this but I'm hoping it will get more responses here.
    Chris

  • Error Handling Question

    I am writing a java program which will run as an automated job. There won't be a user sitting there watching it. If it throws an exception where should I put it? Normally I do
    catch (Exception e){
    e.printStackTrace();
    But that won't do any good if it's running automatically. How do I set System.err path?
    Is there a way for me to print the stack trace into a log file?

    You can use System.setErr() (or something like that).
    Or you can use one of the other printStackTrace signatures--one takes a PrintStream arg, one takes a PrintWriter.
    Or, when you run it from the command line, you can redirect stderr and stdout. In bourne shell family on Unix it's
    java Whatever > /path/to/your/file 2>&1
    Or you could use a logging package, such as what's built into Java (since 1.4 I think, maybe 1.3), and configure it to write to a file. or log4j. Personally I like log4j. If you use Jakarta Commons Logging package, you can write the logging calls without regard to which underlying logging system you use.
    The last option is the best for any "real" production app, IMHO, but it also involves a bit of a learning curve, and if you've already got printStackTrace() all over your code, it means changing existing code.
    &para;

  • Simple error handling

    how can i catch a NullPointerException and print the line "The list is empty" across an entire class, without modifying every individual method?

    The problem is that when i try to call any mutator method on the list, when there is infact no list, the class will throw a NullPointerException
    What i want is that System.err.println("The List is empty"); is called whenever a NullPointerException occurs, rather than just crashing the program...
    i could always do try, catch in every single method... but i thought there must be a cleaner way of doing this...
    here's the code:
    public class StringLinkedList
        private ListNode head;
        public StringLinkedList()
            head = null;
        public String getLast() {
            ListNode position = head;
            while (position.getLink() != null)
                position = position.getLink();
            return position.getData();
        public String getBeforeLast() {
            ListNode position = head;
            while ((position.getLink()).getLink() != null)
                position = position.getLink();
            return position.getData();
        public int length()
            int count = 0;
            ListNode position = head;
            while (position != null)
                count++;
                position = position.getLink();
            return count;
        public void addANodeToStart(String addData)
            head = new ListNode(addData, head);
        public void addANodeToEnd(String addData) {
            ListNode tail = new ListNode(addData, null);
            ListNode position = head;
            while (position.getLink()!= null) {
                position = position.getLink();
            position.setLink(tail);
        public void deleteHeadNode()
            if (head != null)
                head = head.getLink();
            else
                System.out.println("Deleting from an empty list.");
                System.exit(0);
        public boolean onList(String target)
            return (Find(target) != null);
        private ListNode Find(String target)
            ListNode position;
            position = head;
            String dataAtPosition;
            while (position != null)
                dataAtPosition = position.getData();
                if (dataAtPosition.equals(target))
                    return position;
                position = position.getLink();
            return null;
        public void showList()
            ListNode position;
            position = head;
            while (position != null)
                System.out.println(position.getData());
                position = position.getLink();
    }the second class...
    public class ListNode
        private String data;
        private ListNode link;
        public ListNode()
            link = null;
            data = null;
        public ListNode(String newData, ListNode linkValue)
            data = newData;
            link = linkValue;
        public void setData(String newData)
            data = newData;
        public String getData()
            return data;
        public void setLink(ListNode newLink)
            link = newLink;
        public ListNode getLink()
            return link;
    }

  • Error handling function: ORA-20001: get_dbms_sql_cursor error:ORA-00942: table or view does not exist  is not trapped. Why?

    Why APEX 4.1 Error handling function does not trap  the error of missing table?
    Say, I create simple application with single IR report page and I also assign standard simple error handling function.
    Function works perfectly, except but this case:
    If I just drop a table used by report page and then refresh the page I am getting usual APEX error message:
    ORA-20001: get_dbms_sql_cursor error ORA-00942: table or view does not exist
    and error handling function is not invoked at all.
    Is this a feature or a bug?

    Hi,
    Check the corrections given in the note 990764:
    Reason and Prerequisites
    Up to now, using a characteristic with its own master data read class as the InfoProvider was not supported. This is now released but it is not available for all modelings. Using the attributes in the query is not supported for characteristics that have their own master data read class. Using the attributes in the query causes a termination. The following errors may occur in this case:
    ORA-00942: table or view does not exist
    Fehler in CL_SQL_RESULT_SET  Include NEXT_PACKAGE
    RAISE_READ_ERROR in CL_RSDRV_VPROV_BASE
    Solution
    SAP NetWeaver 2004s BI
               Import Support Package 11 for SAP NetWeaver 2004s BI (BI Patch 11 or SAPKW70011) into your BI system. The Support Package is available once Note 0914305 "SAPBINews BI 7.0 Support Package 11", which describes this Support Package in more detail, has been released for customers.
    In urgent cases you can implement the correction instructions.
    The correction instructions contain the tightened inspection for characteristics.
    Regards,
    Anil Kumar Sharma .P

  • WSN 9791, 3202 error handling

    I have setup a 9791with 3202 and attached a 250ohm resistor to measure a 4-20mA signal at AI0 of the 3202. I am continously measing the input voltage and I am also checking battery voltage, link quality, external power and error messages with simple error handling. Everything seems to work fine. Now I disconnect power from the 3202 and remove the batteries. Surprisingly the input voltage at AI0 remains its value, the battery voltages remains the same, it show that external power is present and the error handling shows no error. After 3 minutes MAX will indicate that the signal has been lost. The VI shows that the external power has been disconnected. All other values remain the same
    I am using LabVIEW 2009FDS and I do not have Pioneer or any other additional software.I have updated the firmware of the 9791 and 3202 to the latest revision.
    How can I show in my VI that the signal has been lost? MAX seems to be able to do it, but only after 3 minutes.Why does the error handling never show anything? Why does the link quality remain the same when signal is lost?
    Thanks
    Solved!
    Go to Solution.

    I am not very impressed by this. I have always been with any NI hardware that I have purchased in the past. I am not sure why there is an error in/out, it does not do anything. The time server as an indicator if the data is old or not would be great IF I had access to a time server. This application will be setup where I have only power and no internet available. Even if I did it would not work because I have to turn off any other network connection to make it work. I have treid the Meinberg time server. It worked once and now I get 12/31/1903 again. As a minimum I would think that the Link Quality would go to 0 and not retain its value. This seems like a firmware issue that NI should fix asap.  This seems not reliable for a stand alone executable.I should be able to select time server or OS system clock. I realize OS system clock may not be very accurate but at least it is something to use for time stamp. NI should also fix that in a future firmware rev. At this time I am leaning towards dumping the NI-WSN and look for something else. I guess I could buy the additional software like RT/pioneer that might allow me to do what I want but the added cost will not be appreciated by my boss. For that money I might be able to purchase something else.

  • Error handling and string controls...

    I have a simple program where You enter something in a String control. It is
    wired to a case structure. The default case wires a 0 to a Simple Error
    Handler, which outputs an error message.
    How do I change the String control to the empty string after I give the
    error message, so that the program isn't stuck giving errors infinitely?
    Thanks,
    Jon

    You can create a local variable of your string control where you can write
    any string into your string control after giving the error massage.
    Niko

  • Displaying errors when Enable automatic error handling option is on

    In order to display error messages do I need general or simple error handler to implement if I have Enable automatic error handling on?
    Solved!
    Go to Solution.

    Both will (optionally) display a popup when an error occurs. The general error handler just has more options for special cases. The simple error handler is typically sufficient.
    If you havce automatic error handing enabled, you'll get a popup whenever a function generates an error AND the error output is not wired. Once you wire an error handler, the automatic error handling will no longer occur.
    To display an error, you can also just place a plain error indicator on the front panel. This avoids annoying popup messages.
    LabVIEW Champion . Do more with less code and in less time .

  • How to add sound to the general error handler

    I'm looking for an easy way to create an audible indication (a beep or something) when the general error handler displays an error message.  Anyone have any suggestions??
    Solved!
    Go to Solution.

    Hi Bill,
    I thought this was an interesting idea, so I wrote up the code and posted it on the NI Community here: Simple Error Handler with Beep.  If you have any cool VIs that you'd like to share, you can post them on the community as well to share them with others.  Thanks!
    Stephen Meserve
    National Instruments

  • Is this a qucik and satisfactory method for CLD error handling? (see image)

    http://i.imgur.com/IiI8D1w.png
    with reference to: http://i.imgur.com/TyNVWQX.png (from success package document)
    Is this too simple an error handler setup?  Assuming non-catastrophic errors are taken care of before leaving any case in my qsm?  An error is only acceptable during debugging isnt it? (unless instructed by requirements?)  
    I'm trying to think of ways to save some time as I've been working so much I let my test date creep up on me...  
    Thanks
    Solved!
    Go to Solution.

    PatLyons wrote:
    Is this too simple an error handler setup?
    In the real world, yes.  For the CLD, that is a minimum to get the points.  Just throw down the Simple Error Handler to show the error dialog and you have "handled the error".  If the spec does not say how to handle the error, stop the loop(s) and show the error dialog.  If you are given a spec of how to handle the error, do whatever you are told.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • ORA-34612: Your program or expression uses too much execution space.

    BIB-9509 Oracle OLAP did not create cursor. oracle.express.ExpressServerExceptionError class: OLAPI Server error descriptions: DPR: Unable to create server cursor, Generic at TxsOqDefinitionManagerSince9202::crtCurMgrs4 OES: ORA-34612: Your program o

  • Please help - files

    Hi, is this possible? I want to read in all the files name from a folder on the c drive called images - c:\images or maybe even in same directory as my class file. I want to put this into an array or vector. Any help is really appreciated (code too p

  • Web transaction test monitor with Extracture rules and replacement parameters.

    We are trying to setup a basic login test for a authentication scenario that uses OASIS Identity Server and Azure ACS Authentication.  It uses a ws security token and is returns from the identity server as a wresult. This is passed to Windows Azure a

  • How do i remove the latest Java update?

    Yesterday Software Update installed a new version of Java which breaks my Juniper Network Connect VPN client. How do i undo this software update? Thanks.

  • How to insert into two tables using a Single ADF creation form?

    Hi, I need to make a ADF Creation Form that will insert the data at same time in two tables... Like i have two tables Track (Track_id,Track_Name) and Module ( Module_id, Track_id, Module_name, Module_Short_name) and i have to insert the data in both