Re: Error Trapping
- Posted by "Boehme, Gabriel" <gboehme at POBOXB1.HQ.MSMAIL.MUSICLAND.COM> May 12, 1999
- 355 views
Ferlin wrote: > In some languages there is a Trap() function or On_Error() >function to accomplish what I need, but I can't seem to find the >code that was left or any thing similar. Well, there *is* a routine which allows you to leave a message on the screen in the event of an abend -- see LIBRARY.DOC for info on crash_message(). However, I don't believe Euphoria has the error-handling techniques you describe above. > Here's the situation, I have a procedure such as: > >global procedure My_Procedure(sequence Obj) > puts(1,"You sent " & Obj & " to My_Procedure") >end procedure > > If the procedure is called like this My_Procedure(buffer) >all is fine, but if it is called like this My_Procedure() > > the program BOMBS with My_Procedure() needs 1 arguments, not 0 > >I would like to capture this Error and perform and Error Routine, rather >than have the program stop. [snip] The problem here is that this is a *compile*-time error, not a run-time error. Euphoria doesn't even let this get past the compile step, since it "knows" that My_Procedure is supposed to take exactly *one* argument. So you couldn't trap this error with a routine even if you wanted to. >This is just a quick example, but I would >like to Trap different kinds of Errors. [snip] Perhaps if you gave us more examples describing the other kinds of errors you'd like to trap for? Be seeing you, Gabriel Boehme ------ The way we describe our world shows how we think of our world. How we think of our world governs how we interpret our world. How we interpret our world directs how we participate in it. How we participate in the world shapes the world. Robert Fripp ------