Code Editor (no Errors)

Discussion in 'Buildbox 3.0' started by kodagames, Oct 1, 2018.

  1. kodagames

    kodagames Avid Boxer

    Joined:
    Oct 11, 2015
    Messages:
    294
    Likes Received:
    115
    Hello,

    I've been playing around with the code inside a script node and reviewing the Javascript logs while in play mode and noticed there are no errors.

    Is there anything in store for an editor?
    I'm bad at writing code and don't want to publish something that could either crash or not compile.
     
  2. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    Then you don't have any errors. It throws up red text in the log window when anything is wrong. If you know you have errors and you're not seeing any red text in the log window, then the only thing I can think of is the code you wrote is not being called.

    The code is interpreted, not compiled. I think I've done everything wrong that's possible and it does not crash, it just throws errors. If there are errors, things will not work, but the app doesn't crash.

    BTW kodagames, you're welcome to PM me and I'll help you figure out what's going on.
     
  3. kodagames

    kodagames Avid Boxer

    Joined:
    Oct 11, 2015
    Messages:
    294
    Likes Received:
    115
    Appreciate that ;)
    Code:
    It must just skip that code entirely;
    Your alright @LBPToo
     
    Last edited: Oct 1, 2018
  4. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Red text? I've never seen that.
    I'm using BB 3.0.0 b#2250. What version are you using? (Menu => BuildBox => About)

    Can you give an example of a coding error you've seen red text in your log window?

    Thanks
     
  5. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    #2250 for me too. Here's a pic of what it looks like. JSError.jpg
     
  6. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Wow. Thanks for that.

    The only error messages in my log window are ones I try/catch print myself. Oh the hours and frustration what you have would save me.

    I'm on Mac. You on PC?

    @DanFarfan
     
  7. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    I do BB3 development on a PC, and just do testing on a Mac. I used to use the Mac mostly but had graphics issues with B1 so switched to PC. I just tried this on my Mac, and it doesn't display errors either. Bummer. I'm surprised this hasn't been mentioned on here before. At least I haven't seen it reported.
     
  8. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Thanks for checking. At least we know it isn't some setting or option different. Man, is it ever slow gping flying blind.

    It really points to a larger issue. Where is the list of known bugs. We are in beta. We need it with the next release.
    Right now every issue is.
    Is my typing bad?
    Is my code bad?
    Is my interpretation of operation bad?
    Is operation not working yet?
    Am I losing my mind?


    ;-)
     
    LBPToo likes this.
  9. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    Yep, I hear yah. I can't imagine doing what I've done with nodes without the error info.

    BTW, logging is working on Mac, are you using that? You can track down a lot of errors by seeing if variables are doing what you expect them to do, but it's still going to be a lot slower.
     
  10. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Oh? Is that different than clicking the log button on the preview window? That's all I know about ( Zack has used that in his videos) . How do you start / display what you are talking about?
     
  11. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
    No, I'm just talking about what Zack showed in the videos. Just making sure you knew about it. BTW, when you do get error reporting working, it does misreport sometimes. Though it usually reports the right line, I have had a couple of cases where the error shown has no relation to the real error....not even the same node, but like I said, this is rare. If you've done other programming, which you obviously have, I'm sure you've run into this in every debugger you've used.

    log('My variable x and y value = ' + myVariable.x + ' ' + myVariable.y);
     
  12. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Yes. Every compiler and interpreter has its own oddities regarding error identification. But wrong node? I can't think of a specific reason for that off the top of my head. Seems to me wrong line usually has something to do with a typo that confuses the issue of where a line ends... such as a dangling (aka unmatched) quote or brace or parenthesis.

    Until the mac can show me simple errors as you described, I'm going to consider it a mandatory pro tip to surround all function calls with try / catch. I recently discovered that in this environment that's the only way basic errors will be displayed. Here's an example template I'm using at the moment.

    const _f = "thisEntityName.thisNodeName";

    signal function (name, value ) {
    const f = `${_f}.signal`;
    try {
    let my_answer = callMyFunction(var1, var2);
    } catch (err1) {
    _log(`${f} err1 = ${err1}`);
    }
    } // signal

    This should report *any* error in callMyFunction.

    There are a few things going on here, but for now, I encourage everyone to use the newer ` ` notation instead of + for string concatenation. You can search online about all the advantages. It's all I use any more.

    @DanFarfan
     
    LBPToo likes this.
  13. LBPToo

    LBPToo Avid Boxer

    Joined:
    Nov 1, 2016
    Messages:
    233
    Likes Received:
    141
  14. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42

Share This Page