• Javascript Catch Error

    From High Spirit@VERT/DCBBS to All on Fri Dec 15 18:44:03 2017
    Is there anyway to catch an error and prevent Synchronet from disconnecting when the error occurs?

    -- High Spirit Digital Realms Main - connect.digitalrealms.net 23
    Digital Realms C=64 - connect.digitalrealms.net 6400

    ---
    þ Synchronet þ Digital Creation BBS -- bbs.digitalcreationbbs.com:23
  • From echicken@VERT/ECBBS to High Spirit on Fri Dec 15 19:39:57 2017
    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