Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Advanced exception handling

AValexAValex Member Posts: 6
The tool that leads you to success.
The new excited way to handle exceptions and to be notified about your application's fault when customer worked with it.
The unique way to restore the state of application afte it made a fault.
Interested, visit:
http://www.labitweb.com

There you will find detailed description of LabitStudio and FailureAgent

Comments

  • MasterijnMasterijn Member Posts: 188
    [b][red]This message was edited by Masterijn at 2004-4-1 3:20:47[/red][/b][hr]
    : The tool that leads you to success.
    : The new excited way to handle exceptions and to be notified about your application's fault when customer worked with it.
    : The unique way to restore the state of application afte it made a fault.
    : Interested, visit:
    : http://www.labitweb.com
    :
    : There you will find detailed description of LabitStudio and FailureAgent
    :
    :
    I think I'll write my own adv exception handling. Zibadian mentioned how to do it:
    http://www.programmersheaven.com/c/msgboard/read.asp?Board=4&MsgID=250199. In this way it can be done from within the application.




  • AValexAValex Member Posts: 6
    : I think I'll write my own adv exception handling. Zibadian mentioned how to do it:
    : http://www.programmersheaven.com/c/msgboard/read.asp?Board=4&MsgID=250199. In this way it can be done from within the application.
    :
    Yes, but you need to do it in every module and every application you are developing, this will increase the cost of application development and supporting.
    LabitStudio and FailureAgent provides you unique way that is compiler independed and catches all exceptions even those raised in system and third party dll's which are used in your application.

    Just try it now. It does not require any inputs.
  • MasterijnMasterijn Member Posts: 188
    : : I think I'll write my own adv exception handling. Zibadian mentioned how to do it:
    : : http://www.programmersheaven.com/c/msgboard/read.asp?Board=4&MsgID=250199. In this way it can be done from within the application.
    : :
    : Yes, but you need to do it in every module and every application you are developing, this will increase the cost of application development and supporting.
    : LabitStudio and FailureAgent provides you unique way that is compiler independed and catches all exceptions even those raised in system and third party dll's which are used in your application.
    :
    : Just try it now. It does not require any inputs.
    :
    That's not really the case. A globally shared unit can hookup in any application and handle all exceptions in the whole application. It doesn't require much work. It's comparable to your companies solution, but now the hooking is done from within. I think most of us just want to use the delphi compiler. B.T.W. not every exception should be trown at the user, and that decision should be made from within the application.


  • AValexAValex Member Posts: 6
    : A globally shared unit ....
    It will increase the size of all modules of your application. Is not it?

    : B.T.W. not every exception should be trown at the user
    It is offten happens, that an exception has been raised in third party dll and was handled in it, but the exception was caused by wrong data passed to a function. You can write information about this exception(module name, function name, function's parameters, application environment and etc) into a log file for further analysing.

    :: that decision should be made from within the application.
    It depends on your desire :)

    Proposed way allows you to obtain all the information about a state of application right after Microsoft Windows detected the exception. In your case you will get a control after the exception will be handled (a stack unwinded at this point you physically can not get all information about exception)

    If the exception can be handled in application you need not stop application processing. Let it work its way.

    But if unhandled exception has been raised you will be notified about it right after the exception has been raise, the application's state is intact at this point.
  • MasterijnMasterijn Member Posts: 188
    : : A globally shared unit ....
    : It will increase the size of all modules of your application. Is not it?
    :
    : : B.T.W. not every exception should be trown at the user
    : It is offten happens, that an exception has been raised in third party dll and was handled in it, but the exception was caused by wrong data passed to a function. You can write information about this exception(module name, function name, function's parameters, application environment and etc) into a log file for further analysing.
    :
    : :: that decision should be made from within the application.
    : It depends on your desire :)
    :
    : Proposed way allows you to obtain all the information about a state of application right after Microsoft Windows detected the exception. In your case you will get a control after the exception will be handled (a stack unwinded at this point you physically can not get all information about exception)
    :
    For intelligent handling of exceptions a try except block will do the trick. It acts within a meaningfull context. If exceptions are handled globally this context is not known, so I don't see the added value in that perspective. I agree on the other hand that logging exceptions can give a developer some insight.
    : If the exception can be handled in application you need not stop application processing. Let it work its way.
    :
    : But if unhandled exception has been raised you will be notified about it right after the exception has been raise, the application's state is intact at this point.
    :



  • AValexAValex Member Posts: 6
    : For intelligent handling of exceptions....
    Yes, proposed way is an intelligent way to handle exceptions.
    You will get a control at the point the exception is raised, your application is stopped by the system and function that raised an exception is still on the stack.
    Here you can analyse the state of application and operating system.
    I can get all the information not only about exception.

    A global exception handling is just usual way of exception handling, it is not any extention of exception handling. By setting up global exception handler, you just install a gag...
    To execute global exception handler the system need to find it, unwind the stack (to make it possible to execute your exception handler), correct a contents of IP register and start application execution at this new point. Just try to unwind the stack, you will see nothing useful there... the contents of ESP and EBP registers was updated, about exception you only have information stored in EXCEPTION_INFORMATION structure, but I am sure you do not have this structure.

  • AValexAValex Member Posts: 6
    : Yes, proposed way is an intelligent way to handle exceptions.
    : You will get a control at the point the exception is raised, your application is stopped by the system and function that raised an exception is still on the stack.


    It is even possible to continue execution of this function, by changing the contents of registers at this point you can avoid raising an exception again. I can send you a small application with source codes that raises an exception and by catching it changes the contents of registers successfuly continues the execution from the point the exception has been raised.
  • MasterijnMasterijn Member Posts: 188
    : : Yes, proposed way is an intelligent way to handle exceptions.
    : : You will get a control at the point the exception is raised, your application is stopped by the system and function that raised an exception is still on the stack.
    :
    :
    : It is even possible to continue execution of this function, by changing the contents of registers at this point you can avoid raising an exception again. I can send you a small application with source codes that raises an exception and by catching it changes the contents of registers successfuly continues the execution from the point the exception has been raised.
    :
    How do you know what to put in the registers anyway? In how many cases does this solve anything at all? If an exception is raised, it should be raised, that is its purpose. If it can be avoided then the devolopper should simply write better code. The proposed method by Zibadian is a first change exception handling mechanism. It's very cool for logging/debugging purposes, but that's about it. I know that theoretically the whole applications-code can be overwritten when an exception occurs, but that not very practical, changing register isn't also. An application-state is much more than just the registers and a memory dump. It's about open tables, files, connections, etc.


  • zibadianzibadian Member Posts: 6,349
    : : : Yes, proposed way is an intelligent way to handle exceptions.
    : : : You will get a control at the point the exception is raised, your application is stopped by the system and function that raised an exception is still on the stack.
    : :
    : :
    : : It is even possible to continue execution of this function, by changing the contents of registers at this point you can avoid raising an exception again. I can send you a small application with source codes that raises an exception and by catching it changes the contents of registers successfuly continues the execution from the point the exception has been raised.
    : :
    : How do you know what to put in the registers anyway? In how many cases does this solve anything at all? If an exception is raised, it should be raised, that is its purpose. If it can be avoided then the devolopper should simply write better code. The proposed method by Zibadian is a first change exception handling mechanism. It's very cool for logging/debugging purposes, but that's about it. I know that theoretically the whole applications-code can be overwritten when an exception occurs, but that not very practical, changing register isn't also. An application-state is much more than just the registers and a memory dump. It's about open tables, files, connections, etc.
    :
    :
    :
    The code I gave is a simplification of a global error logging system, I'm developing for my own programs. These include specialized codes for type-casted exceptions, time and location of the exception, and based on the log-parameters even insight in the data/instruction which caused it. All that is based on a single overloaded procedure and try-except blocks, which I placed in a code template. So try-except block handling can also be very quick to code and is more flexible than a global exception hook.
  • AValexAValex Member Posts: 6
    : How do you know what to put in the registers anyway?
    You must not to change a registers state, but you can.

    : If an exception is raised, it should be raised, that is its purpose.
    Yes, if an exception raised, it shoult be raised.
    But did not you see in your program a code like that:

    try
    // do something
    except
    // handle anyway
    end;
    I am sure you did. I do not want to say you wrote it, but someone...
    Do you want to know that somethere in your application there is the code like that?
    I am sure you do. The proposed way can help you.

    : An application-state is much more than just the registers and a
    : memory dump. It's about open tables, files, connections, etc.
    Yes, but gitting a control right after the exception has been raised you can obtain this information. If the stack was unwinded as a result of normal exception hanling, you neve get information about open tables, files, connections, etc.

    PS: I never supposed that someone will change registers state on exception raised it is an unsafe and tricky way of exception handling, I just said that the state of application is intact. None was changed it is like a virgin....
Sign In or Register to comment.