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

[REBOL] Re: Catching Script Error

From: tim:johnsons-web at: 16-Jul-2001 13:40

Hi Chris:
> In other words - is there some way I can recover gracefully from an error in > a script and give some useful feedback on where the problem was without > REBOL going into a sulk? I can get by with the "There was an error in the > command body", but I'd prefer to be able to give a more useful message :/
Below are dispatch blocks from one of my projects: Have a look at the recovery block and see if that works for you. The sum result is that the rebol error is captured there and the application can procede to some sort of a professional conclusion if error? set/any 'err try[ imports run cgio if okay [ blk: cgio/read-write-file/break-at Template "<!--BEGIN-->" run-command cgio/read-write-file/resume none blk ] close-cgi cgio ][; recovery block err: disarm err prin rejoin ["<br>" newline "======>ERROR: "] print reform bind (get in (get in system/error err/type) err/id) in err 'type close-cgi cgio ] HTH tj p.s. below is simple error routine toss: func[arg][make error! rejoin arg]