#80810 - 2002-05-10 08:03 PM
on error
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
something like :
onerror("exit @error") $objConn = CreateObject("ADODB.Connection") $objConn.ConnectionTimeout = $ConnTimeout $objConn.Open($ConnDSN) endonerror
instead of
$objConn = CreateObject("ADODB.Connection") if @ERROR exit @ERROR endif $objConn.ConnectionTimeout = $ConnTimeout if @ERROR exit @ERROR endif $objConn.CommandTimeout = $CmdTimeout if @ERROR exit @ERROR endif $objConn.Open($ConnDSN) if @ERROR exit @ERROR endif [ 10 May 2002, 20:06: Message edited by: Radimus ]
|
Top
|
|
|
|
#80811 - 2002-05-20 11:54 PM
Re: on error
|
MCA
KiX Supporter
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear Radimus,
A good idea. In some other languages we have such capability. It will reduce the requirement of additional code for abnormal situations. Specially when scripts aborts.
Our suggestion is to extend your OnError function with the capability to execute a piece of kixtart script f.e.
- OnError(exit @error)
- OnError(MessageBox("Script abort with error @error (@serror)","KiXtart @scriptname"))
- $message='MessageBox("Script abort with error @error (@serror)","KiXtart @scriptname")'
OnError(Execute($message) Exit @error)
greetings.
|
Top
|
|
|
|
#80812 - 2002-05-21 03:25 PM
Re: on error
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
that is exactly what I meant...
|
Top
|
|
|
|
#80813 - 2002-05-21 03:37 PM
Re: on error
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
This came up a little while ago...
Here it is: On Error handler?
|
Top
|
|
|
|
#80814 - 2003-05-29 09:58 PM
Re: on error
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
I need it too!
_________________________
Jens Kalski
|
Top
|
|
|
|
#80820 - 2003-06-05 09:47 AM
Re: on error
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
Here is a little sample
code:
BREAK ON $ = SETOPTION("Explicit", "ON")
GLOBAL $False $False = (0=1) DIM $Status
GLOBAL $HTTPRequest $HTTPRequest = CreateObject("winhttp.winhttprequest.5.1") IF @ERROR <> 0 $ = Log("CreateObject [winhttp.winhttprequest.5.1] failed!") QUIT ENDIF
$Status = CheckURL("http://www.microsoft.com/") ? "http://www.microsoft.com/" + " --- " + $Status
$Status = CheckURL("http://infoportal.gv.hamburg.de/infoportal") ? "http://infoportal.gv.hamburg.de/infoportal" + " --- " + $Status
$Status = CheckURL("http://www.microsoft.com/") ? "http://www.microsoft.com/" + " --- " + $Status
EXIT 0
;------------------------------------------------------------------------------
FUNCTION CheckURL($URL) $HTTPRequest.SetProxy(2, "proxy.gv.hamburg.de", "<localhost>;") $HTTPRequest.SetTimeouts(2000, 2000, 2000, 2000) $ = $HTTPRequest.Open("GET", $URL, $False) $ = $HTTPRequest.Send ; Here the script dies when it timeout $CheckURL = $HTTPRequest.Status ENDFUNCTION
The Script dies after the .Send when it times out. How can this be catched with kix?
_________________________
Jens Kalski
|
Top
|
|
|
|
#80822 - 2003-06-05 10:58 AM
Re: on error
|
JensKalski
Starting to like KiXtart
Registered: 2000-12-13
Posts: 186
Loc: Germany
|
Maybe it's a Kix-Bug.
_________________________
Jens Kalski
|
Top
|
|
|
|
Moderator: Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 496 anonymous users online.
|
|
|