User Tools

Site Tools


exception_handler_vogui
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


exception_handler_vogui [2018/03/25 17:57] (current) – created wolfgangriedmann
Line 1: Line 1:
 +====== Exception handler for a VO GUI application ======
 +
 +The following code shows the exception message in a VO GUI messagebox. You should combine every exception handler with a logging functionality - a messagebox is gone too easily.
 +
 +<code>static class ExceptionHandler
 +static method ProcessException( oException as Exception ) as void
 +local cMessage as string
 +local oParent as object
 +local oBox as TextBox
 +
 +cMessage := oException:Message
 +// log to disk here
 +do while oException:InnerException != NULL_OBJECT
 +  // log to disk here
 +  cMessage += CRLF + oException:Message
 +enddo
 +oParent := GetObjectByHandle( GetActiveWindow() )
 +if oParent == null_object
 +  oParent := nil
 +endif
 +oBox := TextBox{ oParent, "Error", cMessage }
 +oBox:Type := BOXICONHAND
 +oBox:Beep := true
 +oBox:Show()
 +
 +return</code>
  
exception_handler_vogui.txt · Last modified: 2018/03/25 17:57 by wolfgangriedmann