I've noticed in the last few logons with that SyncWx app, the following error message:
!Javascript c:\sbbs\xtrn\syncwx\weather.js line 103: SyntaxError: JSON.parse
Re: SyncWx Issue
By: Daryl Stout to KenDB3 on Wed Jan 03 2018 07:52 pm
I've noticed in the last few logons with that SyncWx app, the following error message:
!Javascript c:\sbbs\xtrn\syncwx\weather.js line 103: SyntaxError: JSON.parse
I noticed that on my BBS as well.
!Javascript c:\sbbs\xtrn\syncwx\weather.js line 103: SyntaxError: JSON.parse
Any idea what that means?? I'd hate to have to remove that app from the
Re: SyncWx Issue
By: Daryl Stout to KenDB3 on Wed Jan 03 2018 19:52:43
!Javascript c:\sbbs\xtrn\syncwx\weather.js line 103: SyntaxError: JSON.parse
Any idea what that means?? I'd hate to have to remove that app from the
The script is receiving a response from the Weather Underground API which it is unable to parse as valid JSON data.
If this happens consistently, then it's possible that something about the API has changed, and Kenny will need to refactor the script for that.
If it happens intermittently, then it isn't a big problem.
In either case, My suggestion to Kenny would be to wrap lines 364 through 367 in a try ... catch statement:
try {
forecast();
console.pause();
console.clear();
console.aborted = false;
} catch (err) {
// maybe log the error here
} finally {
exit();
}
This should have the effect of making the script fail silently (user sees nothing except maybe a bit of a delay) if something goes wrong. The forecast() function does a few things (HTTP request, JSON parse) that can throw errors, so it would be good to catch them.
I like the solution, I'll implement it as soon as I get a chance. Right now I am preparing for a really bad winter storm up here in Rhode Island. I fully expect to lose power for a day or three.
JSON.parse
I noticed that on my BBS as well.
It's working here. I assume the web-site where it pulls its data must be down or returning something unexpeced. Hopefully it corrects itself.
| Sysop: | Winzlo |
|---|---|
| Location: | Minnesota, USA |
| Users: | 11 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 495947:06:31 |
| Calls: | 82 |
| Files: | 1,070 |
| D/L today: |
27 files (11,920K bytes) |
| Messages: | 287,048 |