Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 09:40 03 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Option Error Continue - Invalid?

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 09:11pm 24 Dec 2016
Copy link to clipboard 
Print this post

Hi folks.

Trying to simply issue Option Error Continue at the top of my code, but MMBASIC rejects it as not valid:





Manual says it should work - what gives?

Have tried this with and without all caps - makes no difference and is rejected.
I will comment-out this line for now.Edited by Grogster 2016-12-26
Smoke makes things work. When the smoke gets out, it stops!
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 06:31pm 25 Dec 2016
Copy link to clipboard 
Print this post

Grogster, I believe On Error continue may have been replaced with the On Error Skip (etc) format.

I use the following method now extensively in code using SDcard calls plus for any other sensitive areas that could cause the program to halt and where watchdog resets are too inelegant. I would prefer to have a more universal error trap system but this is all we currently have.

Like in the following snippet,
sub readfile(fname$,Dest$)
local a$,b$
on error skip
OPEN fname$ FOR input AS #1
if ChkErr()>0 Then goto exitread
print "Start of Doc Send"
.
.
.
exitread:
stopFlag=0
print "End of Doc Send"
end sub



I then have a Function call that evaluates the err and can take further action if required within the function etc (here I am also returning the error via a wifi network) but usually I just make an orderly exit so i can close open files etc.

Function ChkErr() As Integer
ChkErr=0
if mm.errno<>0 then
print "Error# ";mm.errno; " "; mm.errmsg$
xbsend "udp.send:|"+from$+"|Error#|"+ str$(mm.errno) + " " + mm.errmsg$ +"|"
WaitforReady 'reset flag
ChkErr=1
end if
end function

Codenquilts
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 06:38pm 25 Dec 2016
Copy link to clipboard 
Print this post

Awesome, thanks.

I did not know that - although, OPTION ERROR CONTINUE is still listed in the manual.....

In any event, ON ERROR SKIP is probably more useful, so I will work on that premise.
Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024