Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Error handling problems revisited

 [1/3] from: kpeters::otaksoft::com at: 14-Nov-2007 18:55


I cannot seem to figure it out... Here's what I am doing: =============== mysql-obj: attempt [ make object! load %mysql.cfg ] mysql-url: rejoin [ mysql:// mysql-obj/user ":" mysql-obj/password "-" mysql-obj/host ":" mysql-obj/port "/" mysql-obj/database ] mysqlport: none ;-------------------------------------------------------------------------------------------------- mysql-query: function [ {Either returns [["ERROR"]], [["EMPTY"]] or [[<cursor>]} querystr [string! block!] statusbar [object! none!]] [ cursor ] [ if error? set/any 'mysql-error try [ mysqlport: open mysql-url cursor: send-sql mysqlport querystr close mysqlport ] [ disarm mysql-error if statusbar <> none [ set-face statusbar reform [ "MySQL-Connection error: " mysql-error/arg1 ]] return [["ERROR"]] ] if cursor = [] [ return [[ "EMPTY" ]] ] either cursor/1/1 = none [ return [[ "EMPTY" ]] ] [ return cursor ] ] I set the IP of my MySQL server in %mysql.cfg to a non-existent number in my network in order to trigger an error. Here's what I would expect: ================== The error we see below should get trapped in my code and the mysql-query function should return [["ERROR"]] Here's what I get: ============ ** Access Error: Cannot connect to 192.168.1.223 ** Where: open-proto ** Near: mysqlport: open mysql-url cursor: send-sql Why does my code not catch this? Any help *greatly* appreciated! Kai

 [2/3] from: gregg:pointillistic at: 14-Nov-2007 22:18


Hi Kai, KP> disarm mysql-error mysql-error: disarm mysql-error DISARM doesn't disarm in place. -- Gregg

 [3/3] from: kpeters::otaksoft::com at: 14-Nov-2007 23:12


Thanks, Gregg~ am no longer suicidal! Kai On Wed, 14 Nov 2007 22:18:48 -0700, Gregg Irwin wrote: