• Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums

Stacktrace for Cloud Code errors?

Scheduled Pinned Locked Moved Cloud Code
cloud code scriptrhinocloud code
6 Posts 4 Posters 539 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Travis Brown-John
    wrote on last edited by
    #1

    Is there a way to get a full stacktrace for errors?

    Especially when using bridge.include, it is possible to have deeply nested logic which makes it very difficult to track down the code path that caused the errors.

    I have some code that works locally (node.js env), but not in Rhino, it seems:

    const Assert = {}; 
    
    function stackTrace() {
        var err = new Error();
        return err.stack;
    }
    Assert.assert = function(expr, message){
        if ( !expr ){
            console.log(stackTrace());
            throw message;
        }
    };
    

    Thanks,
    Travis

    1 Reply Last reply
    2
  • dhptD Offline
    dhptD Offline
    dhpt
    wrote on last edited by
    #2

    I'm interested in this too! I tried a few things that didn't seem to work. Since there's no "step through" like GameSparks, for example, gotta rely on stacktraces for fast debugging.

    I find myself devving a bit slow when I have errs due to no stacktraces. Or ... is there a way?

    1 Reply Last reply
    0
  • Paul WinterhalderP Offline
    Paul WinterhalderP Offline
    Paul Winterhalder brainCloudAdmin
    wrote on last edited by
    #3

    It looks like the next Rhino release may have some extra support for us there. We will look to enable it once it's available.

    A 1 Reply Last reply
    0
  • A Offline
    A Offline
    Ali Raza
    replied to Paul Winterhalder on last edited by
    #4

    @Paul-Winterhalder fingers crossed

    1 Reply Last reply
    0
  • dhptD Offline
    dhptD Offline
    dhpt
    wrote on last edited by
    #5

    I was just looking into this the other day, too! Like most issues in cloud script, it's a Rhino issue - you never know what isn't fully implemented, and the lacking IDE features doesn't let you know.

    What I did was ghetto, but it worked. In every script, I make an array that tracks stacktrace, then I try/catch everything. I rethrow until I get to my main func, where I funnel it to an err handler.

    It looks like the next Rhino release may have some extra support for us there. We will look to enable it once it's available.

    The new Rhino release (already out) will even add ${} templating and backtick support~

    1 Reply Last reply
    0
  • Paul WinterhalderP Offline
    Paul WinterhalderP Offline
    Paul Winterhalder brainCloudAdmin
    wrote on last edited by
    #6

    Well - the new release isn't out yet - it's just a Release Candidate.

    https://github.com/mozilla/rhino/releases

    That said - we are very happy to see the progress - since it has been over a year since 1.7.13 was released!

    Hopefully soon!

    1 Reply Last reply
    0

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users