Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
2-D Animation Studio - Error Handling by M. Ahsan Hussain
Our Parser caught errors such as:
- wrong xml tags
- actor not created doing actions
- invalid actions for an actor
These errors were caught and passed on to the ScriptMorph class as a string.
The way we displayed our errors was to show "ERROR————->" at the start of the error string in the script. The way we did this was to find where the error string was in the Script and then insert the error text right before it. This is a small method I wrote that places teh "ERROR—–>" right before the error string in the script:
highlightFrom: start to: stop
"This highlights the from and to portion that take in integer locations"
textMorph editor selectFrom: (start-1) to: (start-1). "just putting error message"
(start = 0)ifFalse:[
textMorph editor zapSelectionWith: 'ERROR———————->'.
In this case, since all I had to was to insert the "ERROR——>" string before the start of the error string, I used selectFrom: start-1 to: start-1.
The error message that pops up is very simple. All you have to do is type: "PopUpMenu inform: errorStr" where errorStr (string) is the content of your error message pop up.
Even though this was quite effective in pointing out the error, we would recommend some sort of highlighting if possible. In the amount of time we had to code, I was unable to figure out a way to change color of the error text in the script. I was able to grab the error string in the Script (textMorph) but wasn't sure what to replace it with.
Link to this Page
- Team Quattro Cases last edited on 4 May 2006 at 11:55 am by h-66-167-193-154.atlngahp.dynamic.covad.net