User Tools

Site Tools


exception_handler_vogui

Differences

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

Link to this comparison view

exception_handler_vogui [2018/03/25 19:57] (current)
wolfgangriedmann created
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 19:57 by wolfgangriedmann