n9mfk wrote:Ray this was in your message
I found a way to check the progress of my modification and to determine (approximately) where an error had occurred
I has ask how you had done this ?
OK, now the muddy waters are getting clearer ... matter of writing...
You meant for the JavaScripts...
With some small scripts, such as the one I use for Cumulus, I placed a line such as 'document.write('MADE IT UP TO HERE!')' at or near the top of the script and moved the line downward as I added new functions (below the new function or the newly added code).
For example, using David's CumulusWeatherConsole script ('wconsole.js'), I would place the 'document.write('MADE IT UP TO HERE!')' at line 60:
Code: Select all
...
$("#today-temphigh").html(rawdata[26] +" at "+ rawdata[27]);
$("#today-templow").html(rawdata[28] +" at "+ rawdata[29]);
$("#today-windgust").html(rawdata[32] +" at "+ rawdata[33]);
$("#today-windavg").html(rawdata[30] +" at "+ rawdata[31]);
$("#last_contact").html(rawdata[0] +" "+ rawdata[1]);
document.write('MADE IT UP TO HERE!')
// Calculate the Beaufort desc
var beau = rawdata[12];
if (beau=="0"){var bdesc="Calm";} else
if (beau=="1"){var bdesc="Light Air";} else
if (beau=="2"){var bdesc="Light Breeze";} else
...
So, when I run the code through my server, and I see on the screen the words 'MADE IT UP TO HERE!', I know that the top part of the code is OK.
Then, I would add some more lines of code and I would move the 'document.write('MADE IT UP TO HERE!')' line below that new code.
This line is not reporting any error message nor the exact location of the error, but has help me in pinpointing the area where the code error might be. But, if there is a jump to an other function, then the line has to be move also within that function.
It is time consuming but with patience, one eventually gets to the end of the script. The longest script I worked on had in excess of 2800 lines of code (that was the latest version of 'ajaxWDwx') - thankfully, the script designer, Rainer Finkeldeh, had included a special control line of code before every major functions/operations. So, when the script is run on my local or Internet server (it sees my IP address) it displays (very quickly, almost impossibly to see/view ... unless there is an error in the previous code group) the text contained within all the control lines and eventually displays the control line '[Status: OK] [progress: -- DONE --]' message, meaning that the code has run as expected (from top to bottom) without any error.