Re: Javascript Catch Error
By: High Spirit to All on Fri Dec 15 2017 10:44:03
Is there anyway to catch an error and prevent Synchronet from disconnecting when the error occurs?
Try to avoid situations where your script will throw an error. When you
can't do that, wrap any code likely to generate an error in a try...catch:
try {
throw 'this is an error';
} catch (err) {
log(err);
}
There are often better ways of doing things, though. When doing file I/O for example, you can avoid most errors by checking whether a file exists, whether it was opened successfully, etc. before trying to do stuff with it.
---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com