Is there a way to create a label to goto at after an error has occurred somewhere in the code? Sometimes programs can be complicated enough to the point where you cant debug all errors because you can't know all the errors, and it would be great if i could save data before SB resets all the variables.When an error occurs, it tells you the line the error occurred at. Is this what you wanted? You could always add a label manually after you see an error.
Saving Data After An Error?
Root / Programming Questions / [.]
MZ952Created:
Is there a way to create a label to goto at after an error has occurred somewhere in the code? Sometimes programs can be complicated enough to the point where you cant debug all errors because you can't know all the errors, and it would be great if i could save data before SB resets all the variables.
Um, no not quite like that. I mean after an error occurs somewhere in the code, I want to GOTO @ a label and execute that code under that label.Is there a way to create a label to goto at after an error has occurred somewhere in the code? Sometimes programs can be complicated enough to the point where you cant debug all errors because you can't know all the errors, and it would be great if i could save data before SB resets all the variables.When an error occurs, it tells you the line the error occurred at. Is this what you wanted? You could always add a label manually after you see an error.
Like continuing from wherever you left off?? I think you might be able to use CONT for that, but you might need to have a STOP added before the error. EDIT: If you need your variables saved STOP/CONT should work.Not sure about just CONT, though...Um, no not quite like that. I mean after an error occurs somewhere in the code, I want to GOTO @ a label and execute that code under that label.Is there a way to create a label to goto at after an error has occurred somewhere in the code? Sometimes programs can be complicated enough to the point where you cant debug all errors because you can't know all the errors, and it would be great if i could save data before SB resets all the variables.When an error occurs, it tells you the line the error occurred at. Is this what you wanted? You could always add a label manually after you see an error.
I know what you are looking for, the only thing you could do is write your own function and run it where you are having an issue. Adding error checking to sections with intermittant options are it.
You can also do some debugging after a crash as all variables are still set until you run again.
It's not possible to handle exceptions unfortunately. It would be super useful. But there are some hacky workarounds.
How I manage this, is I save the data needed to a prg slot at regular intervals in my program. Then if the user either exits the application prematurely, or an error occurs, the data is still in the prg slot. You'll need to handle this when your program starts by checking to see that values exist in the prg slot and give the user the option to restore. Let me know if you need a more specific explanation.
It's not possible to handle exceptions unfortunately. It would be super useful. But there are some hacky workarounds. How I manage this, is I save the data needed to a prg slot at regular intervals in my program. Then if the user either exits the application prematurely, or an error occurs, the data is still in the prg slot. You'll need to handle this when your program starts by checking to see that values exist in the prg slot and give the user the option to restore. Let me know if you need a more specific explanation.Oh, yes, seems a viable method. Though, sometimes exporting backup data to a prg slot just isnt as feasible when you've got a massive array of data to store, say such as that as a text editor would use. It would cause some unaesthetic lag on the interface, at least in my case.
That was a concern of mine as well. I managed to hide the backup lag behind state transition so that the automatic backup intervals could be longer apart. User are more forgiving, when lag happens at predictable times, like exiting a menu or something like that.