listbuild) uitgevoerd via de classmethods Act...(). Deze laatste kunnen op zich nog eens "Custom" routines oproepen. De foutgegevens en eventueel extra info kan via de array arErrInfo worden doorgegeven. Het uiteindelijke resultaat is meestal een ErrorPage, JS alert msg of een Redirect url.]]> User vhLib.Macro,vhLib.cspError cache %CSP.Error 0 Parameter moet aangepast worden in afgeleide klasse /csp/wss/vhLibError.csp 59836,58461 CustomEHandlerInitTEMPLATE() Deze method moet hernoemd worden naar CustomEHandlerInit() en de code ge-uncomment worden. Stel dan in welke ACTIONS bij een foutmelding uitgevoerd worden. 1 lbErrTypes ",$LB($$$EmailTo),"CSP - Error - "_$ZDT($H,4),"§DFL_HTML§",,1) Set %cspEHandler($$$etPageLoadError,"ACTIONS","ErrPage")=$LB("%CSP.Error","OnPage") ; $LB("","OnPageMinimum") Quit */ ]]> 1 lbErrTypes 0) Kill tmpAr Do @("dehBuildAr"_ErrType) Merge %cspEHandler(ErrType)=tmpAr Quit dehBuildArPageLoadError ; PageLoadError Set tmpAr("ACTIONS")=$LB("LogDB","Email","ErrPage") Set tmpAr("ACTIONS","LogDB")=$LB("DFL") Set tmpAr("ACTIONS","Email")=$LB("""CSPserver "_$system.Server.HostName()_""" ",$LB($$$EmailToSysOp),"CSP - Error - "_$ZDT($H,4),"§DFL_HTML§",,0) Set tmpAr("ACTIONS","ErrPage")=$LB("~") Quit dehBuildArPreHTTPTimeOut ; PreHTTPTimeOut Set tmpAr("ACTIONS")=$LB("ErrPage") ; or RedirURL Set tmpAr("ACTIONS","ErrPage")=$LB("~") Quit dehBuildArHyperEventError ; HyperEventError Set tmpAr("ACTIONS")=$LB("LogDB","Email","JSAlert") Set tmpAr("ACTIONS","LogDB")=$LB("DFL") Set tmpAr("ACTIONS","Email")=$LB("""CSPserver "_$system.Server.HostName()_""" ",$LB($$$EmailToSysOp),"CSP - Error - "_$ZDT($H,4),"§DFL_HTML§",,0) Set tmpAr("ACTIONS","JSAlert")=$LB("Error returned by server call") Quit dehBuildArHyperEventTimeOut ;HyperEventTimeOut Set tmpAr("ACTIONS")=$LB("JSAlert") Set tmpAr("ACTIONS","JSAlert")=$LB("Session TimeOut") Quit ]]> Method to OVERRIDE when defining custom %cspEHandler for "HyperEventTimeOut". Deze definities zijn globaal voor de hele CSP-application; het is immers niet mogelijk om bij "HyperEventTimeOut" de OrigCSPClassName te detecteren om daar de CustomEH array in te vullen. 1 1 %Boolean 1 If an error occurs while processing a HyperEvent then this method is called. This method will write out javascript code that will be executed on the browser. 1 listbuild) uit]]> 1 FromMethod:%String 0) . ;Set blnMatch=(blnMatch)&&("...") ; Other criteria . If blnMatch Set MatchNode=i Quit MatchNode hceExecuteEHAtion(Action) // Possible values for Action: Quit:($LF($LB("ErrPage","JSAlert","Email","LogDB","Redir","CustomCOS","CustomJS"),$G(Action))'>0) New lbActionDefs Set lbActionDefs=arActs("ACTIONS",Action) ;d $$$DBG("Execute action "_Action_" values="_$$$LCVT(lbActionDefs)) If Action="ErrPage" Do . Do ..ActErrPage(lbActionDefs) Else If Action="JSAlert" Do . New tmpMsg . ;Set tmpMsg="TestMessage by WimV:"_$$$CRLF_##class(%CSP.LogError).ErrString() . If $G(arActs("MSG",Action,1))'="" Set tmpMsg=arActs("MSG",Action,1) . Else Set tmpMsg=$LG(lbActionDefs,1) . Do ..ActJSAlert($LB(tmpMsg,1)) Else If Action="Email" Do . New tmpBody . If $G(arActs("MSG",Action,1))'="" Set tmpBody=arActs("MSG",Action,1) . Else Set tmpBody=$LG(lbActionDefs,4) . Do ..ActEmail($LB($LG(lbActionDefs,1),$LG(lbActionDefs,2),$LG(lbActionDefs,3),tmpBody,0,$LG(lbActionDefs,6)),.arErrInfo) Else If Action="LogDB" Do . Do ..ActLogDB(lbActionDefs,.arErrInfo) Else If Action="Redir" Do . Do ..ActRedir($LB($LG(arActs("ACTIONS",Action),1)),.arErrInfo,"") Else If Action="CustomCOS" Do . Else If Action="CustomJS" Do . Else Do . ; Nothing Quit ]]> Vult de basis error info in de Array arErrInfo op. De array arErrInfo als .local doorgeven 1 1 FromMethod:%String,ErrNumber:%Integer %String Geeft de ClassName terug van de klasse of csp-page van waaruit de Error gegenereerd werd. 1 FromMethod:%String 1 %Status 1 %Status &html< Error

Error on CSP page.

#($S(blnDirect:"", $L($G(cls)_$G(mth)):"

[no OnPage method: wrong value specified: Class="""_$G(cls)_""" , method="""_$G(mth)_"""]

", 1:""))#
> Do opmDisplayErrorHidden &html< > Quit $$$OK opmDisplayErrorHidden // Internet Explorer doesn't work without this routine !!! (WHY? don't know) &html<
> New ErrorInfo Do ..DecomposeError(%request.Get("Error:ErrorCode"),.ErrorInfo) Do ..DisplayError(.ErrorInfo) &html<
> Quit ]]>
lbArgs=$LB(classname, methodname) 1 lbArgs=$LB(message As %String, UseQuoteJS As %Boolean = 1) 1 lbArgs=$LB(From,lbTo,Subject,Body,BodyIsStream=0,blnHTML=0) 1 %Status " #define DflSubject "CSP ERROR" Quit:($G(lbArgs)=$LB("Skip")) "" ; Don't send E-mail New From,lbTo,Subject,Body,BodyIsStream,blnHTML,msg,CustomMsg,sc,tmpStream Set From=$LG(lbArgs,1, $$$DflFrom) Set lbTo=$LG(lbArgs,2) Set Subject=$LG(lbArgs,3, $$$DflSubject) Set Body=$LG(lbArgs,4) Set BodyIsStream=0 ; $LG(lbArgs,5,0) Set blnHTML=$LG(lbArgs,6,0) Quit:(lbTo="")||($LG(lbTo,1)="") "" Set tmpStream="" If Body="" Do . Do actMailBodyMinimum Else If Body="§DFL_HTML§" Do . Do actMailBodyDflHTML Else If Body="§DFL_TEXT§" Do . Do actMailBodyDflText Else If Body="~" Do . Set Body="" Else Do ; Nothing. Use values as passed by lbArgs #If ($ZCVT($ZUTIL(110),"U")'["WWW") Do ; Send to SoapSysOp only on WWW; else replace by "WV" . New i . Set i=$LF(lbTo,"ICT_SOAPSysOp@vanhoecke.be") . Set:(i>0) $LI(lbTo,i)="wv@vanhoecke.be" #EndIf ; Send E-mail If $IsObject($G(tmpStream)) Do . Set sc=$$SendMiniMailXtd^vhLib.Mail(From,lbTo,Subject,tmpStream,1,blnHTML) Else Do . Set sc=$$SendMiniMailXtd^vhLib.Mail(From,lbTo,Subject,Body,$G(BodyIsStream,0),blnHTML) If 'sc ; Set errmsg=$$ParseStatus^vhLib(sc)_" From="_From Set tmpStream="" Quit sc actMailBodyMinimum Set Body="CSP ERROR: "_$$$CRLF_##class(%CSP.LogError).ErrString()_$$$CRLF Set blnHTML=0 Quit actMailBodyDflText Set Body="" Set Body=Body_"CSP ERROR:"_$$$CRLF Set Body=Body_""_$$$CRLF Set Body=Body_##class(%CSP.LogError).ErrString()_$$$CRLF Set Body=Body_""_$$$CRLF Set Body=Body_"--- End of message ---"_$$$CRLF Set blnHTML=0 Quit actMailBodyDflHTML Do IOToStream^vhLib(.tmpStream,$LB("CLASSM","%CSP.Error","OnPage")) Set blnHTML=1 Quit ]]> lbArgs=$LB(LogType,Applic,lbCustomLog) lbCustomLog=$LB(mth,cls,blnWithInfo[=1]) waarbij cls de ClassName van de op te roepen klasse is (en mth de method); pre-defined values: §OrigCSP§ (="" leeg) - CSP page / §ErrH§ - this error page 1 Short ; Type: [HTML] Quit $LB(Time,FromMethod,Applic,,,,,,RefNd,$G(Type)) actLogNodesShort(NewNode) ; NewNode als .local doorgeven New tmpAr,ErrorInfo If $D(arErrInfo("ErrorInfo")) Do . Merge ErrorInfo=arErrInfo("ErrorInfo") Else Do ; in case arErrInfo not supplied . Do ..DecomposeError(%request.Get("Error:ErrorCode"),.ErrorInfo) Set tmpAr=$$actLogNodeMainData(CurTime,$G(FromMethod),,,Applic) Set tmpAr($$$KeepNd)=0 If $O(ErrorInfo($O(ErrorInfo(""))))="" Do . Merge tmpAr($$$LogNd)=ErrorInfo($O(ErrorInfo(""))) Else Do . Merge tmpAr($$$LogNd)=ErrorInfo Set NewNode=$$actLogAddToGlobal("S",.tmpAr) Quit (NewNode>0) actLogNodesLong(NewNode) ; NewNode als .local doorgeven #define MaxBlockSize 32000 New tmpStream,tmpAr,sub,sLine,tmpLen Set tmpStream=##class(%Library.FileCharacterStream).%New() Do IOToStream^vhLib(.tmpStream,$LB("CLASSM","%CSP.Error","OnPage")) Set tmpAr=$$actLogNodeMainData(CurTime,$G(FromMethod),,"HTML",Applic) Set tmpAr($$$KeepNd)=0 Set tmpAr($$$LogNd)=0 Set tmpLen=$$$MaxBlockSize+1 Do tmpStream.Rewind() For Quit:(tmpStream.AtEnd) Do . Set sLine=tmpStream.ReadLine() . If (tmpLen+$L(sLine))>$$$MaxBlockSize Do .. Set sub=$INCREMENT(tmpAr($$$LogNd)) .. Set tmpAr($$$LogNd,sub)="" .. Set tmpLen=0 . Set tmpAr($$$LogNd,sub)=tmpAr($$$LogNd,sub)_sLine . Set tmpLen=tmpLen+$L(sLine) ; Replace unnecessary HTML tags/attributes (font formatting) Set sub="" For Set sub=$O(tmpAr($$$LogNd,sub)) Quit:(sub="") Do . Set tmpAr($$$LogNd,sub)=$$$Replace(tmpAr($$$LogNd,sub)," face=""Verdana,Arial,Helvetica,sans-serif""","") . Set tmpAr($$$LogNd,sub)=$$$Replace(tmpAr($$$LogNd,sub)," face=""Verdana, Arial, Helvetica, sans-serif""","") . Set tmpAr($$$LogNd,sub)=$$$Replace(tmpAr($$$LogNd,sub),"","") . Set tmpAr($$$LogNd,sub)=$$$Replace(tmpAr($$$LogNd,sub),"","") . Set tmpAr($$$LogNd,sub)=$$$Replace(tmpAr($$$LogNd,sub),"","") Set NewNode=$$actLogAddToGlobal("L",.tmpAr) Set tmpStream="" Quit (NewNode>0) actLogAddToGlobal(NdType,arNewLog) ; arNewLog als .local doorgeven New NewNode,i,Cnt Set NewNode=$Increment($$$globLog(NdType)) Merge $$$globLog(NdType,NewNode)=arNewLog Do:($G($$$globLog("DEF",NdType,"MaxNodes"))>0) actLogCleanUp Quit NewNode actLogCleanUp Set Cnt=1 Set i=NewNode For Set i=$O($$$globLog(NdType,i),-1) Quit:(i<1) Do . Quit:($G($$$globLog(NdType,i,$$$KeepNd),0)) . Set Cnt=Cnt+1 . If Cnt>$$$globLog("DEF",NdType,"MaxNodes") Kill $$$globLog(NdType,i) Quit ]]> lbArgs=$LB(Url) 1 1 %String lbArgs=$LB() 1 lbArgs=$LB() 1