• Javascript error message handling

    From Michael Long@VERT to alt.bbs.synchronet on Thu Oct 8 06:09:59 2020
    From Newsgroup: alt.bbs.synchronet

    Is there a way from javascript to handle the error like the C function errormsg, where it writes it to the consoles with red "The sysop has been notified" and puts it in the log?
    --- Synchronet 3.18c-Win32 NewsLink 1.113
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From echicken@VERT/ECBBS to Michael Long on Thu Oct 8 10:28:01 2020
    Re: Javascript error message handling
    By: Michael Long to alt.bbs.synchronet on Thu Oct 08 2020 06:09:59

    Is there a way from javascript to handle the error like the C function errormsg, where it writes it
    to the consoles with red "The sysop has been notified" and puts it in the log?

    Sure:

    try {
    doSomethingThatMightThrowAnException();
    } catch (err) {
    log(LOG_ERR, err);
    console.putmsg('\1+\1h\1r' + err + '\1-\r\n');
    }

    There's lots to be read online about error handling in JS, including the optional and rarely useful 'finally' block.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Digital Man@VERT to Michael Long on Thu Oct 8 11:14:01 2020
    Re: Javascript error message handling
    By: Michael Long to alt.bbs.synchronet on Thu Oct 08 2020 06:09 am

    From Newsgroup: alt.bbs.synchronet

    Is there a way from javascript to handle the error like the C function errormsg, where it writes it to the consoles with red "The sysop has been notified" and puts it in the log?

    There's no single function that does that in Sync-JHS, but this would be very similar:

    alert(log(LOG_ERR, "Some error happened") + ", sysop has been notified");

    digital man

    Rush quote #11:
    Struck between the eyes by the big time world, walking uneasy streets
    Norco, CA WX: 68.1°F, 74.0% humidity, 2 mph NNW wind, 0.00 inches rain/24hrs ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net