Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ON ERROR question
#16
(08-17-2024, 02:53 AM)TerryRitchie Wrote:
(08-16-2024, 10:58 PM)RhoSigma Wrote: I see one big problem here, let's say I use your colordepth library, so you set the handler to label COLORDEPTH_BIFILE and in the end you simply reset the handler (ON ERROR GOTO 0). But what is when I had a handler label "MyDumbErrHandler" active before calling the Colordepth function, and my following code assumes it points still to that handler?

Currently there's no way in the language to figure out where's the current error handler is pointing to, so I'd strongly suggest not to change it in external library code, as you can't correctly restore it to the original state.
Well poo, I was thinking about that too. What's needed is a way to test if image handles are valid.

So as it appears to me a method to restore to a previous error handler can be done pretty simple.

ON ERROR GOTO handler 'regularly set a handler
ON ERROR GOTO 0 'regularly disable programmatically error handling

ON ERROR GOTO _LASTHANDLER 'restore to the previous handler

However, if _LASTHANDLER is used without a hander set previously, then we could throw an runtime error or simply restore it to ON ERROR GOTO 0 silently. The latter is better I guess.
Reply


Messages In This Thread
ON ERROR question - by TerryRitchie - 08-16-2024, 07:16 PM
RE: ON ERROR question - by RhoSigma - 08-16-2024, 07:51 PM
RE: ON ERROR question - by Pete - 08-16-2024, 08:29 PM
RE: ON ERROR question - by TerryRitchie - 08-16-2024, 09:16 PM
RE: ON ERROR question - by Pete - 08-16-2024, 09:38 PM
RE: ON ERROR question - by TerryRitchie - 08-16-2024, 09:43 PM
RE: ON ERROR question - by Pete - 08-16-2024, 09:54 PM
RE: ON ERROR question - by TerryRitchie - 08-16-2024, 10:00 PM
RE: ON ERROR question - by Pete - 08-16-2024, 10:19 PM
RE: ON ERROR question - by SMcNeill - 08-16-2024, 10:41 PM
RE: ON ERROR question - by RhoSigma - 08-16-2024, 10:58 PM
RE: ON ERROR question - by TerryRitchie - 08-17-2024, 02:53 AM
RE: ON ERROR question - by RhoSigma - 08-17-2024, 02:10 PM
RE: ON ERROR question - by TerryRitchie - 08-17-2024, 06:59 PM
RE: ON ERROR question - by Pete - 08-16-2024, 11:23 PM
RE: ON ERROR question - by Pete - 08-17-2024, 04:24 AM
RE: ON ERROR question - by luke - 08-17-2024, 11:58 AM
RE: ON ERROR question - by eoredson - 09-02-2024, 04:39 AM
RE: ON ERROR question - by Pete - 08-19-2024, 03:15 AM



Users browsing this thread: 5 Guest(s)