Re: Stop excution (aka silent exception)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Two things stand out from your response:
a) "throw new exception('the msg here')"
b) "and move on with the application"

Without going into a diatribe here, global exception handling should have
two purposes and two purposes only:
1. To log the stacktrace and other useful info that will enable the
development team to accurately pinpoint why the exception wasn't handled.
2. To display a friendly msg to the user before exiting (or restart the app
if you can).

You should not expect to recover from a centralised error handling routine
(by definition your app is in an indeterminate state). You should also not
be using global exception handling for exceptions that you *explicitly*
throw (as opposed to exceptions that get thrown under circumstances you
didn't design for). If you are in a scenario where you can recover from
whatever the user did, then don't throw, instead return appropriate values
to calling functions.

So in light of the above I suggest you rethink what you want out of GEH and
if what you want isn't what it is meant to be used for then I suggest you
rethink your whole design/approach. If you decide you do want to use GEH for
what it was intended, then you have to use CF v2.0.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"Shloma Baum" <shlomabaum-spam@xxxxxxxxx> wrote in message
news:OPSHBpwNGHA.2064@xxxxxxxxxxxxxxxxxxxxxxx
Daniel,

I'm glad you understand what I mean, the main reason for me needing this,
is due to the CF not properly handling unexpected exceptions (as you know
<G>) as I'm used to in the full framework, where I have in code wheever I
accounter an error in my class I call throw new exception('the msg here')
then in my global handler I have my own exception form where it does lots
of stuff like, display the error to the user (it does not always have to
be something unexpected), give option to send an email to us etc. and move
on with the application, and I would love to work the same way in my CF
project, however whenever an exception occours the app shuts down and this
is really changing the way I'm developing. This is why I was looking for a
function that would sort of work the same, and in the CF whenever I want
to raise an exception I would call that function, however I don't see this
as being able to accomplish it.

If you still have an idea to offer me I would appreciate that
Best Regards,
Shloma

"Daniel Moth" <dmoth74@xxxxxxxxxxx> wrote in message
news:ev2txawNGHA.3164@xxxxxxxxxxxxxxxxxxxxxxx
I see what you mean now. I am glad to say that no such construct exists.
If you need that you should build it into your application logic (return a
status/flag that the calling function check and so on up to the root). Of
course, I would question why you feel you need to bypass business logic in
such a way, in a non-exceptional circumstance. Any such mechanism should
at least give an opportunity to each participant up the calling stack to
clean up.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"Shloma Baum" <shlomabaum-spam@xxxxxxxxx> wrote in message
news:Ooh%23n%23uNGHA.2828@xxxxxxxxxxxxxxxxxxxxxxx
Daniel,

'return' only stops excution of the current method but does not stop
excution of the calling method as well, as does an exception that stops
any method that called the current method: e.g.

void method1()
}
method2;
// someother code;
}

void method2()
{
return;
// someother code;
}

where when you call method2 the return would only not excute the
'someother code' of method2, howeveer the 'someother code' of method1
will
still be excuted. However if you throw an exception it will stop the
excution of method1 as well.

Thanks in advance
Shloma



"Daniel Moth" <dmoth74@xxxxxxxxxxx> wrote in message
news:OXkTV5uNGHA.3460@xxxxxxxxxxxxxxxxxxxxxxx
return

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"Shloma Baum" <shlomabaum-spam@xxxxxxxxx> wrote in message
news:um736IuNGHA.2336@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I would like to ask if its possible to stop in the middle of some code
all running code, something like:

if (someCondition)
abort;

and the whole call stack should stop, the same that happens when an
exception occours, but I don't want the exception dialog should
appair,
but rather just only stop the excution, and of course I dont' want the
application to close when this occours.

Thanks in advance
Shloma Baum













.



Relevant Pages

  • Re: class-wide begin/end blocks/exception handling
    ... class HiThere ...  rescue Exception => msg ...   self.exceptionHandle ...
    (comp.lang.ruby)
  • Re: is parameter an iterable?
    ... which leads me to belive that 'msg' is not type. ... it's an instance of the exception type, ... create a SomeError exception and pass the value as its ... Python will treat this as ...
    (comp.lang.python)
  • GDI+ Exception
    ... We have experienced following exception in our application that runs ... I had gone through the internet to find an answer about ... at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg) ... wparam, IntPtr lparam) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Array of Exceptions
    ... Hit the go button and the exception thrown depends on the array index ... Whenever the code catches a lower-level exception, e.g., IOException, if I must rethrow it I rethrow the standard one with the original one as the cause. ... throw new FabulatorException(msg, ex); ...
    (comp.lang.java.programmer)
  • Re: GDI+ Exception
    ... When I made my comments about this exception it was in relation to code ... Manual doule buffering seems to prevent this from ever happening. ... Answer those GDI+ questions with the GDI+ FAQ ... > at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg) ...
    (microsoft.public.dotnet.languages.csharp)