On Wednesday 29 August 2007, Kai Peters wrote:
> I am testing my code and run the function below against a non-existent
> mysql server:
>
> Hmm - thought that try should catch this but apparently other things=
> happen:
Kai, below is a basic code framework that I use for my rebol CGI
scripts. Most relevant to error handling is the last two lines.
I hope that you find this a helpful example
cheers
tim
(code follows)
;; ======================================
application: [; execution block
cgi/init ;; initialize cgi handler
cgi/set[testservers: test-server-names]
db-profile: ["*****" "*****" "127.0.0.1" "*****"] ;; mysql login info
db[init db-profile] ;; log into mysql server
main ;; code here
db[close]
cgi/close
]
;;======================================
;; 'print-error is the error handling function
except: [print-error disarm err ]
if error? set/any 'err try application except
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.