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

[REBOL] Trapping errors? - Not like the book says?

From: doug::vos::eds::com at: 3-Aug-2000 10:06

I have read and re-read the sections REBOL the official guide. about errors. (eg. pages 276 and following) Then I put together a function to log errors called log-event (with a refinement for handling disarmed error objects). The log-event function will then log the date, time, script name, "error", and molded error object. if error? error: try [send [joe--blow--go--go] {test} ][ ; this will probably force an error log-event/error system/script/header/file "error" (disarm error) ; since go.go is not a valid domain ] It works great if there is an error, however, if there is not an error, you get this other error message.--> if error? error: try [send [doug--vos--eds--com] {test} ][ ; this will probably NOT force an error log-event/error system/script/header/file "error" (disarm error) ; and I'll get your test message ] ** Script Error: error needs a value. ** Where: if error? error: try [ send [doug--vos--eds--com] {test} ] Because error does not receive a value when it interprets " error: try " -- since there is not an error. So then I tried... if error? error: try [send [joe--blow--gogogo--com] {test} (disarm error) ][ ; not in the book, but I was just trying stuff log-event/error system/script/header/file "error" (disarm error) ] This is bad because the script runs for a while but it is constantly disarming error that never really occured.... This sort of works but fills up my log file with junk and then eventually the program crashes with a garbage collection error. Douglas Vos - EDS/GM-BSU Webmaster e-Mail: mailto:[doug--vos--eds--com]